Re: Scatter Plots

<[email protected]> Tue, 9 Nov 2004 13:39:21 -0600
Newsgroups gmane.comp.krysalis.jcharts.user
Message-ID <[email protected]>
Hi, 
I was trying to create a scatter plot. I could get the outline of the chart and the labels, titles etc.. but no data points. Following is the code. Could you tell me whats going wrong ..
 

public void scatterChartDraw(BaseXWPropertyMap view, ChartDataSet cData, BaseXWPropertyMap style) throws ChartDataException, PropertyException
 {
   String[] xAxisLabels = { "1998", "1999", "2000", "2001",
                                     "2002", "2003", "2004" };
   String xAxisTitle = "Years";
   String yAxisTitle = "Problems";
   String title = "Microsoft 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.red};
   
   Stroke[] strokes = { ScatterPlotProperties.DEFAULT_LINE_STROKE };
   Shape[]  shapes = { PointChartProperties.SHAPE_DIAMOND};
   ScatterPlotProperties properties =
    new ScatterPlotProperties(strokes, shapes);
   
   AxisChartDataSet axisChartDataSet =
    new AxisChartDataSet(data, legendLabels, paints,
      ChartType.SCATTER_PLOT, properties );
   dataSeries.addIAxisPlotDataSet (axisChartDataSet);
   
   ChartProperties chartProperties   = new ChartProperties();
   chartProperties.setBackgroundPaint((Paint) Color.LIGHT_GRAY ); 
   chartProperties.setBorderStroke( (ChartStroke) ChartStroke.DEFAULT_AXIS ); 
   
   AxisProperties axisProperties     = new AxisProperties();
   LegendProperties legendProperties = new LegendProperties();
   
   AxisChart axisChart= new AxisChart(dataSeries, chartProperties,
     axisProperties, legendProperties,
    width, height);
  
   this.exportImage( axisChart, filePath );
  

 }