From: David H. <Dav...@na...> - 2004-03-12 13:56:57
|
I didn't even know that ScatterPlot exists since it wasn't included in the documentation. Isn't a scatter plot supposed to show correlation between two variables? Anyway, I tried the ScatterPlot to see whether it can show X-axis labels as well as y point values. My code below draws a chart (including x-axis and y-axis labels, title, and legends) but without data points. Am I missing something? 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 = { ScatterPlotProperties.DEFAULT_LINE_STROKE }; Shape[] shapes = { PointChartProperties.SHAPE_CIRCLE }; ScatterPlotProperties properties = new ScatterPlotProperties(strokes, shapes); AxisChartDataSet axisChartDataSet = new AxisChartDataSet(data, legendLabels, paints, ChartType.SCATTER_PLOT, properties ); dataSeries.addIAxisPlotDataSet (axisChartDataSet); ChartProperties chartProperties = new ChartProperties(); AxisProperties axisProperties = new AxisProperties(); LegendProperties legendProperties = new LegendProperties(); AxisChart axisChart= new AxisChart(dataSeries, chartProperties, axisProperties, legendProperties, width-50, height-50); axisChart.setGraphics2D ( (Graphics2D) panel.getGraphics() ); axisChart.render(); >Did you try the ScatterPlot? > > > >--- David Han <Dav...@na...> wrote: >> Is it possible to display y point values in a line chart? Looks like > > there aren't any APIs for this. Is this a correct observation? > -- |