From: David H. <Dav...@na...> - 2004-03-09 15:08:28
|
>did you look at the SwingDemo in the demo package? Yes, I did look prior to posting my message. I don't any difference between my code and the SwingDemo.java code. What is my code missing? private void initComponents() throws ChartDataException, PropertyException { this.setSize( width, height ); this.panel = new JPanel( true ); this.panel.setSize( width, height ); this.getContentPane().add( this.panel ); this.setVisible( true ); String[] xAxisLabels = { "1998", "1999", "2000", "2001", "2002", "2003", "2004" }; String xAxisTitle = "Years"; String yAxisTitle = "Problems"; String title = "Micro$haft at Work"; DataSeries dataSeries = new DataSeries(xAxisLabels, xAxisTitle, yAxisTitle, title ); double[][] data = new double[][]{ { 250, 45, -36, 66, 145, 80, 55 } }; String[] legendLabels = { "Bugs" }; Paint[] paints = {Color.blue}; Stroke[] strokes = { LineChartProperties.DEFAULT_LINE_STROKE }; Shape[] shapes = { PointChartProperties.SHAPE_CIRCLE }; LineChartProperties lineChartProperties = new LineChartProperties(strokes, shapes ); AxisChartDataSet axisChartDataSet = new AxisChartDataSet(data, legendLabels, paints, ChartType.LINE, lineChartProperties ); dataSeries.addIAxisPlotDataSet (axisChartDataSet); ChartProperties chartProperties = new ChartProperties(); AxisProperties axisProperties = new AxisProperties(); LegendProperties legendProperties = new LegendProperties(); AxisChart axisChart= new AxisChart(dataSeries, chartProperties, axisProperties, legendProperties, 450, 450); axisChart.setGraphics2D ( (Graphics2D) this.panel.getGraphics() ); axisChart.render(); } -- David Han dav...@gs... 301-286-3617 |