From: Mike E. <mi...@mi...> - 2003-06-18 14:46:16
|
import org.jCharts.axisChart.AxisChart; import org.jCharts.chartData.*; import org.jCharts.properties.*; import org.jCharts.types.*; import java.awt.*; public class a extends Panel { LegendProperties lp = null; ChartProperties cp = null; BarChartProperties ctp = null; AxisChart c = null; AxisProperties ap = null; public a() throws Exception { ChartProperties cp = new ChartProperties(); ctp = new BarChartProperties(); String[] xAxisLabels = {"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004"}; String xAxisTitle = "Years"; String yAxisTitle = "Problems"; String title = "Micro$oft At Work"; DataSeries ds = new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle, title ); double[][] data = new double[][]{{1500, 6880, 4510, 2600, -1200, -1580, 7000, 4555, 4000, 6120}}; String[] legendLabels = {"Bugs"}; Paint[] paints = new Paint[]{Color.yellow}; ds.addIAxisPlotDataSet(new AxisChartDataSet( data, legendLabels, paints, ChartType.BAR, ctp)); lp = new LegendProperties(); ap = new AxisProperties(false); c = new AxisChart(ds, cp, ap, lp, 400, 400); } public static void main(String args[]) throws Exception { Frame f = new Frame("a"); Panel p = new Panel(); a a = new a(); p.add(a); f.add(p); f.pack(); f.setVisible(true); a.c.renderChart(); } } |