Copyright 2005, J4L
Components (http://www.java4less.com)
Go bak to contents
If you want to create barchart you must use SERIE_TYPE_*=BAR (or BarPlotter class). The following is a complete example of a barchart with 2 series and negative values:
Parameters
|
Description
|
Equivalent java class/property
|
TITLECHART=Sales 2002 |
Title and labels |
new Title("Sales 2002"); |
By changing the following
parameters you can convert it to a horizontal barchart:
Parameters
|
Description
|
Equivalent java class/property
|
BARCHART_VERTICAL=FALSE XSCALE_MIN=-15 |
Horizontal bars |
barPlotter.verticalBar |
Bars can also be forced to start at a fixed possition instead of the default, which is 0.
Parameters
|
Description
|
Equivalent java class/property
|
BARCHART_BASE=5 |
Starting possition of bars |
barPlotter.barsBase=5; |
You can also assign a different color to each bar in your series.
Parameters
|
Description
|
Equivalent java class/property
|
SERIE_BARS_COLORS_1=RED|BLUE|BLACK|YELLOW|CYAN |
Colors of the bars |
serie1.barStyles=styles; |
Each bar can also start at a different possition by means of the SERIE_BARS_START_ parameter .
Parameters
|
Description
|
Equivalent java class/property
|
SERIE_DATA_1=12|43|50|45|30|45 |
End possition of the bars. |
see values in BarDataSerie constructor |
The following parameters will allow you to control the width:
The main parameter is BARCHART_BARWIDTH
Parameters
|
Description
|
Equivalent java class/property
|
BARCHART_BARWIDTH=4 |
Bar's width |
barPlotter.barWidth=4; |
this parameter has priority over the other parameters.
If you don't want to specify the width of the bars you can also specify the distance between bars and the distance between groups of bars:
Parameters
|
Description
|
Equivalent java class/property
|
BARCHART_BARSPACE=4 |
space between bars |
barPlotter.interBarSpace=4; |
if you have only 2 bars you can end up with the right bar overlapping the legend:
you can solve this problem by adding 0.5 to the maximum value of the scale. In the example:
Parameters
|
Description
|
Equivalent java class/property
|
XSCALE_MAX=2.5 |
Make the X axis a bit longer then required so that it looks better. |
chart.XAxis.scale.max=2.5; |
There is avery common error which result is getting the following chart:
which can be solved by setting the correct value for the Y scale:
Parameters
|
Description
|
Equivalent java class/property
|
YSCALE_MIN=0 |
Starting point of the Y scale. |
chart.YAxis.scale.min=0; |
If you want the values of the series to be added (stackbar) then you must set BARCHART_CUMULATIVE=TRUE like in the following example:
Parameters
|
Description
|
Equivalent java class/property
|
BARCHART_CUMULATIVE=TRUE |
Activate stackbar chart |
barPlotter.cumulative |
Eventcharts have the following properties:
In this way the chart can represent length of activities.
Parameters
|
Description
|
Equivalent java class/property
|
SERIE_BARS_START_1=0|15|30 |
Starting possitions of bars (serie 1) |
serie1.addBarsBase (startValues); |
If you want to create 3D barchart you must use SERIE_TYPE_*=BAR3D (or BarPlotter3D class). The following is a complete example:
Parameters
|
Description
|
Equivalent java class/property
|
TITLECHART=Sales 1999 |
Title and labels |
new Title("Sales 1999"); |
All parameters are the same as in the 2D barcharts. The following parameter are 3D barchart specific:
the following parameter controls the depth of the bars:
Parameters
|
Description
|
Equivalent java class/property
|
BARCHART3D_FULL_DEPTH=false |
Bars should not be as deep as the Z axis. In this case the depth of the bars will be the length of the Z axis / 2. |
barPlotter3D.fullDepth=false; |
You can specify the length of the Z axis with:
Parameters
|
Description
|
Equivalent java class/property
|
BARCHART3D_DEPTH=5 |
Change length of the Z axis (pixels) |
barPlotter3D.depth=5; |