Java jspChart V 1.60
Version française English
Main page
Home
[ aDraw | tCalDate | tListe | tEuroCalc | tCalEvent | tChart | tFunction | tOnglet | tCChat | tCount ]
[ aTicker | aFont | aSearch | tBBar | tMButton tButton tScroll | tPassword | Winmine ]
[ Home | Applets | Servlets | ASP components ]

INDEX



News V 1.60
VERSION 1.60
  • New mode "simple point" (8)
  • Support multi charts on 1 graphe
  • Support 2 oY axes
  • Change calcul in min and max values
  • ...
VERSION 1.00
    This component is the extension of acxChart and of cChart It allows to generate dynamically graphs and charts.
    If you wish further possibilities for this component, do not hesitate to contact us.
  • Support of the GIF and PNG format
  • Generation of the image without creating a temporary file.
  • Support bars; lines, area, pies, ...
  • Rotation of the texte
  • ...
Index



Description
jspChart is an JAVA Component allowing to create dynamically a "chart". It runs with any standard graphs formats : bar, line, surface, arc of a circle, ...
It is possible to create this graph from a data base.
Index



Registration
jspChart component is a FreeWare for non commercial sites, it means its use is free. For personal use, I'd like you to add a link to the author (http://www.javaside.com/) and send me the URL of the pages uses the jspChart component.
For professional / commercial use, you have to get a "professional registration". This registration allows you to use jspChart without reference to the author and I will send you back the complete jspChart source code.
If you want to use jspChart in another application, you must get a "professionnal registration". For more informations about "Professional registration") R. BERTHOU.

Index



JSP Source
<jsp:useBean id="zz" scope="session" class="javaside.Rbl.jspChart" />
<% 
       // Declarations
       int iW, iH   ; // Image size
       int iColor   ; // background Color
       int iPres    ; // Presentation
       boolean b1   ; // Legend 
       boolean b2   ; // Bullet 
       String sFormat   ; // Format (gif/png) 

       // get all parameters
       String t = null ; 
       t = request.getParameter("width") ; 
       if (t == null) 
          iW = 400 ; 
       else 
          iW = java.lang.Integer.parseInt(t) ; 

       t = request.getParameter("height") ; 
       if (t == null) 
          iH = 350 ; 
       else 
          iH = java.lang.Integer.parseInt(t) ; 

       t = request.getParameter("color") ; 
       if (t == null) 
          iColor = -1 ; 
       else 
          iColor = java.lang.Integer.parseInt(t, 16) ; 

       t = request.getParameter("pres") ; 
       if (t == null) 
          iPres = 1 ; 
       else 
          iPres = java.lang.Integer.parseInt(t) ; 

       t = request.getParameter("format") ; 
       if (t == null) 
          sFormat = "gif" ; 
       else 
          sFormat = t ; 

       t = request.getParameter("b1") ; 
       if (t == null) 
          b1 = false ; 
       else 
          b1 = t.equalsIgnoreCase("on") ; 

       t = request.getParameter("b2") ; 
       if (t == null) 
          b2 = false ; 
       else 
          b2 = t.equalsIgnoreCase("on") ; 


       // Init image and size
       zz.init(iW, iH) ; 

       // Define Font used
       zz.setFontA("Dialog", 0, 8) ; 
       zz.setFontTitre("Dialog", 3, 10) ; 
       zz.setFontLegend("Dialog", 0, 8) ; 

       // Define  cols
       zz.setCol(2) ; 
       zz.addCol(0, 55255, "Tretis") ; 
       zz.addCol(1, 255,   "Lighoas") ; 

       // Define title and legends
       zz.setTitle("--------------           Test acxChart JSP") ; 
       zz.setLegend("Week 42/2000 ", "Number inc."); 

       zz.setRotate(true); 
       zz.setBkColor( iColor ); 

       // Define all datas
       zz.addRow("Lun . ; 25 ; 32 ; "); 
       zz.addRow("Mar . ; 15 ; 21 ;"); 
       zz.addRow("Mer . ; 21 ; 21 ;"); 
       zz.addRow("Jeu . ; 16 ; 14 ;"); 
       zz.addRow("Ven . ; 12 ; 16 ;"); 
       zz.addRow("Sam . ; 15 ; 16 ;"); 
       zz.addRow("Dim . ; 15 ; 17 ;"); 
       // fin des donnees

       // Presenation type
       zz.setPress(iPres); 
       zz.setOrigine( 40, 50) ; 
       zz.setXPress(b1, b2, false); 

       // Build image
       zz.build(true) ; 

       response.reset(); 
       response.setContentType("image/" + sFormat ); 
       response.addHeader("Content-Disposition","filename=acx." + sFormat); 

       if (sFormat.equalsIgnoreCase("png")) 
          response.getOutputStream().write(zz.getImage(1)); 
       else 
          response.getOutputStream().write(zz.getImage(0)); 

       response.flushBuffer(); 

       // Free resources
       zz.clear() ; 
%>
Index



Functions
This is the list of the open fonctions from your JSP code. Would you please read the samples to see the sequence of the calls.
NomDescription
init(int w, int h)initialization of the image and definition of its size
setFontA(String sFace, int style, int size)
setFontTitre(String sFace, int style, int size)
setFontLegend(String sFace, int style, int size)
definition of the font (default, Title, Legend)
- sFace : name of the font (Dialog, SansSerif,...)
- style : style of the font (0 Normal, 1 Heavy, 2 Italic, 3 Heavy and Italic)
- size : size of the font (6...24)
setCol(int i)Definition of the number of columns
addCol(int iNb, int iColor, String sName) Definition of a column
iNb : Number of the column
iColor : color of the column
sName : Title / Name of the column
setTitle(String s) Definition of the Title
setLegend(String sX, sY) Definition of the axis legends
setRotate(boolean b) Run/Disable rotation of the texte
setBkColor(int iColor) background color
-1 : transparent
setOrigine(int X, int Y) Modification of the origin Ox, Oy : default (40, 40)
addRow(String s) Add a line as a character sequence defined by a ";" : format
String s : Title of the line
Double d[] : Values
Sample : zz.addRow("Dim . ; 15 ; 17 ;")
setPress(int iPres) Definition of the presentation
  • 0 : Bars
  • 1 : Lines
  • 2 : Circle / Arc
  • 3 : Bar Sum
  • 4 : Not use
  • 5 : Surface
  • 6 : Surface Sum
  • 7 : Point
  • 8 : Simple Point
setXPress(boolean b1, boolean b2, boolean b3) Precision in the presentation
- b1 : Legend
- b2 : bullet
- b3 : bInter
setMinMax(double min, double max) force min and max values
setUnit(String s)Definition of the display format of the numbers
build(int b)Creation of the image if b is :
  • "0" the informations with regard to the axis and legends are also displayed
  • "1" the informations with regard to the axis oY are also displayed at Right
  • "2" no informations with regard to the axis oX and oY
build(boolean b)Creation of the image if b is "True" the informations with regard to the axis and legends are also displayed
getImage(int i) Recovery of the image (0 : GIF format / 1 : PNG format)
clearData() Initialization of the datas
saveAs(String s) Save image
readFile(String f)Reading of the data from an external file
Index



History
In construction...

1.60Add mode simple point, support "n" chart, and more...
1.00Creation...

Index



Download files
jspChart V 1.60 Francais jspChart_fr.zip (81 KB)      (backup)
jspChart V 1.60 English jspChart_us.zip (81 KB)      (backup)
Index



Copyright © 1996..2003, BERTHOU. All right reserved.
Last change : 05 March 2003 18H20