Area Charts
|
PDF |
Here is some code to generate an Area Chart. You can send 1..n data sets through it to be plotted.
String[] xAxisLabels= { "1998", "1999", "2000", "2001",
"2002", "2003", "2004" };
String xAxisTitle= "Years";
String yAxisTitle= "Problems";
String title= "Micro$oft at Work";
DataSeries dataSeries = new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle, title );
double[][] data= new double[][]{ { 250, 45, -36, 66, 145, 80, 55 },
{ 50, 145, 6, 166, 105, 110, 85 } };
String[] legendLabels= { "Bugs", "FUD Towards Gnu/Linux" };
Paint[] paints= new Paint[] { new Color( 153, 0, 255 ,100 ),
new Color( 204,0,255, 150 ) };
AreaChartProperties areaChartProperties= new AreaChartProperties();
AxisChartDataSet axisChartDataSet= new AxisChartDataSet( data, legendLabels,
paints, ChartType.AREA,
areaChartProperties );
dataSeries.addIAxisPlotDataSet( axisChartDataSet );
ChartProperties chartProperties= new ChartProperties();
AxisProperties axisProperties= new AxisProperties();
LegendProperties legendProperties= new LegendProperties();
AxisChart axisChart= new AxisChart( dataSeries, chartProperties,
axisProperties, legendProperties,
AxisChartsGuide.width, AxisChartsGuide.height );