com.java4less.rchart
Class LinePlotter3D
java.lang.Object
|
+--com.java4less.rchart.ChartComponent
|
+--com.java4less.rchart.Plotter
|
+--com.java4less.rchart.LinePlotter3D
- public class LinePlotter3D
- extends Plotter
This is the plotter used to draw a line chart. It only accepts DataSeries of type LineDataSerie.
Example of Line chart 3D:
// data
double[] d1={1,1,3,3.5,5,4,2};
double[] d2={2,2,5,6,5.4,3.5,3.1};
// series
LineDataSerie data1= new LineDataSerie(d1,new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLUE),LineStyle.LINE_NORMAL));
data1.drawPoint=false;
data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,11);
LineDataSerie data2= new LineDataSerie(d2,new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.GREEN),LineStyle.LINE_NORMAL));
data2.drawPoint=false;
data2.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,11);
data2.fillStyle=new FillStyle(GraphicsProvider.getColor(ChartColor.GREEN));
// legend
Legend l=new Legend();
l.addItem("Products",new FillStyle(GraphicsProvider.getColor(ChartColor.BLUE)));
l.addItem("Services",new FillStyle(GraphicsProvider.getColor(ChartColor.GREEN)));
// create title
Title title=new Title("Sales (thousands $)");
// create axis
Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale());
Axis YAxis=new Axis(Axis.VERTICAL,new Scale());
XAxis.tickAtBase=true; // draw also first tick
XAxis.scale.min=0;
YAxis.scale.min=0;
YAxis.scaleTickInterval=1;
YAxis.scaleTickInterval=1;
YAxis.bigTickInterval=2;
YAxis.gridStyle=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.GRAY),LineStyle.LINE_NORMAL);
String[] lbls={"June","July","Aug.","Sept.","Oct.","Nov.","Dec."};
XAxis.tickLabels=lbls;
HAxisLabel XLabel= new HAxisLabel("",GraphicsProvider.getColor(ChartColor.BLUE),GraphicsProvider.getFont("Arial",ChartFont.BOLD,14));
VAxisLabel YLabel= new VAxisLabel("Brutto",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.BOLD,14));
// plotter
LinePlotter3D plot=new LinePlotter3D();
// create chart
Chart chart=new Chart(title,plot,XAxis,YAxis);
plot.border=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL);
plot.back=new FillStyle(GraphicsProvider.getColor(ChartColor.WHITE));
chart.back=new FillStyle(GraphicsProvider.getColor(ChartColor.YELLOW));
chart.back.colorFrom=GraphicsProvider.getColor(ChartColor.YELLOW);
chart.back.colorUntil=GraphicsProvider.getColor(ChartColor.WHITE);
chart.back.gradientType=FillStyle.GRADIENT_HORIZONTAL;
chart.XLabel=XLabel;
chart.YLabel=YLabel;
chart.legend=l;
chart.addSerie(data2);
chart.addSerie(data1);
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fixedLimits
public boolean fixedLimits
- clip lines using maximum and minimum values if the scale?
border
public LineStyle border
- style of the lines' border. The default is null (no border).
interLineSpace
public int interLineSpace
- pixels between two 3D lines (ribbons).
LinePlotter3D
public LinePlotter3D()