From: David H. <Dav...@na...> - 2004-03-09 17:36:57
|
Never mind - nothing is wrong with my code. My code works fine on Linux, but it doesn't work on Mac OS X with JDK 1.4.1. I'll try my code with JDK 1.4.2 on Mac OS X and see if that works. Will keep you posted. David >>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 > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >jCharts-users mailing list >jCh...@li... >https://lists.sourceforge.net/lists/listinfo/jcharts-users -- David Han dav...@gs... 301-286-3617 |