net.comrom.chart
Class BarPlotter3D

java.lang.Object
  extended bynet.comrom.chart.ChartComponent
      extended bynet.comrom.chart.Plotter
          extended bynet.comrom.chart.BarPlotter3D

public class BarPlotter3D
extends Plotter

Plotter used to draw a bar chart. It only admits DataSeries of type BarDataSerie.
// data series
double[] d1={1,2,1,4,5,4,2};
BarDataSerie data1= new BarDataSerie(d1,new FillStyle(GraphicsProvider.getColor(ChartColor.ORANGE)));
data1.borderType=BarDataSerie.BORDER_RAISED;
data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10);
double[] d2={-1,3,4,4.2,6.4,4.5,6.1};
BarDataSerie data2= new BarDataSerie(d2,new FillStyle(GraphicsProvider.getColor(ChartColor.RED)));
data2.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10);
data2.borderType=BarDataSerie.BORDER_RAISED;
data2.negativeStyle=new FillStyle(GraphicsProvider.getColor(ChartColor.RED));
// create legend
Legend l=new Legend();
l.border=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL);
l.addItem("Company A",new FillStyle(GraphicsProvider.getColor(ChartColor.ORANGE)));
l.addItem("Company B",new FillStyle(GraphicsProvider.getColor(ChartColor.GREEN)));
l.background=new FillStyle(GraphicsProvider.getColor(ChartColor.LIGHTGRAY));
// create title
Title title=new Title("Benefits companies A & B");
// create axis
Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale());
Axis YAxis=new Axis(Axis.VERTICAL,new Scale());
Axis Y2Axis=new Axis(Axis.VERTICAL,new Scale());
XAxis.tickAtBase=true; // draw also first tick
XAxis.scale.min=0;
XAxis.scale.max=7;
YAxis.scale.min=-2;
YAxis.scale.max=7;
YAxis.IntegerScale=true;
Y2Axis.scale.min=-2;
Y2Axis.scale.max=7;
Y2Axis.IntegerScale=true;
Y2Axis.scaleTickInterval=1;
YAxis.scaleTickInterval=1;
XAxis.scaleTickInterval=1;
XAxis.gridStyle=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.LIGHTGRAY),LineStyle.LINE_DOTS);
YAxis.gridStyle=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.LIGHTGRAY),LineStyle.LINE_DOTS);
String[] lbls={"1998","1999","2000","2001","2002","2003","2004","2005"};
XAxis.tickLabels=lbls;
HAxisLabel XLabel= new HAxisLabel("Year",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.BOLD,12));
VAxisLabel YLabel= new VAxisLabel("million $",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.BOLD,12));
// plotter
BarPlotter3D plot=new BarPlotter3D();
// create chart
Chart chart=new Chart(title,plot,XAxis,YAxis);
plot.interBarSpace=1;
plot.back=new FillStyle(GraphicsProvider.getColor(ChartColor.WHITE));
plot.depth=20;
plot.fullDepth=true;
chart.XLabel=XLabel;
chart.YLabel=YLabel;
chart.legend=l;
chart.addSerie(data2);
chart.addSerie(data1);
chart.legendMargin=0.25;
chart.back=new FillStyle(GraphicsProvider.getColor(ChartColor.YELLOW));


Field Summary
 double barsBase
          start bars at this position
 int barWidth
          Width of the bar.
 boolean cumulative
           
 boolean fullDepth
          if TRUE the depth of the bars will be the same as the depth of the charts.
 int interBarSpace
          space between two bars (pixels).
 double InterGroupSpace
          space between two groups of bars (pixels).
 boolean summedLabels
          if true labels will be the summed values of the bars
 boolean verticalBars
          this fields indicates whether bars (horizontal) or columns (vertical) should be used.
 
Fields inherited from class net.comrom.chart.Plotter
back, backImage, depth, visibleHeight, visibleWidth, XScale, Y2Scale, YScale
 
Fields inherited from class net.comrom.chart.ChartComponent
height, width, x, y
 
Constructor Summary
BarPlotter3D()
           
 
Method Summary
 void addSerie(DataSerie s)
           
 
Methods inherited from class net.comrom.chart.Plotter
getCombinable, getNeedsAxis, getSerie, getSeriesCount, plot, plotBackground, replaceSerie, setSerie
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verticalBars

public boolean verticalBars
this fields indicates whether bars (horizontal) or columns (vertical) should be used.


barWidth

public int barWidth
Width of the bar.


interBarSpace

public int interBarSpace
space between two bars (pixels).


InterGroupSpace

public double InterGroupSpace
space between two groups of bars (pixels).


cumulative

public boolean cumulative

barsBase

public double barsBase
start bars at this position


fullDepth

public boolean fullDepth
if TRUE the depth of the bars will be the same as the depth of the charts.


summedLabels

public boolean summedLabels
if true labels will be the summed values of the bars

Constructor Detail

BarPlotter3D

public BarPlotter3D()
Method Detail

addSerie

public void addSerie(DataSerie s)
Overrides:
addSerie in class Plotter