Krysalis jCharts
 
  Font size:      
 

Bar Charts

PDF
PDF

Bar Charts

Here is some code to generate a Bar Chart.

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  } };
String[] legendLabels= { "Bugs", "Security Holes", "Backdoors" };
Paint[] paints= TestDataGenerator.getRandomPaints( 3 );
BarChartProperties barChartProperties= new BarChartProperties();
AxisChartDataSet axisChartDataSet= new AxisChartDataSet( data, 
                                                         legendLabels, 
                                                         paints, 
                                                         ChartType.BAR, 
                                                         barChartProperties );
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 );
			
Bar Chart


Valid HTML 4.01!Valid CSS!