ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Problem with a Scatter Chart in c# related to datapoints mapping.
Posted by Manoj Kumar on Dec-24-2010 14:31
Hi,

I am Manoj and working using chartdirector for creating graphs and charts for my application.
I am facing issues with Scatter charts.
I am able to create the Scatter chart but it seems that the datapoints are not mapped correctly in the charts.
My requirement is i need my x-axis to be fixed from -30 to +30 range and wants my dataX1 and dataY1 to be plotted on the chart.

I am doing with below steps.

double[] dataX1 = {-6, -12, -4, -3, 7, 8, 9, 10, 12, 11, 8, 20, 25, 30, -3, -10};
double[] dataY1 = {65, 80, 40, 45, 70, 80, 80, 90, 100, 105, 60, 20, 32, 56, 76, 5};
string[] XAxisArray ={-30, -29, .......... , 29, 30};

XYChart c = new XYChart(800, 270, 0xE1FAE9, 0, 0);
c.setRoundedFrame();
c.setPlotArea(30, 20, 700, 210, 0x62F590, 0x62F590, 0xE1FAE9, 0x62F590);
c.yAxis().setLinearScale(0, 110, 10);
c.xAxis().setLinearScale(-30, 30, XAxisArray);

ScatterLayer scLayer = c.addScatterLayer(dataX1, dataY1, "data", Chart.CircleSymbol, 7, 4,0);
scLayer.setXData(-30, 30);

please let me know what steps i am missing as not able to mapped the charts with points being plotted ?

Thanks,
Manoj Kumar

  Re: Problem with a Scatter Chart in c# related to datapoints mapping.
Posted by Peter Kwan on Dec-24-2010 16:46
Hi Manoj,

Please remove the line "scLayer.setXData(-30, 30);".

The line "scLayer.setXData(-30, 30);" means that the data points are spread evenly between x=-30 and x=30. This contradicts with the dataX1. If you are using dataX1 for specify the x-coordinates for all points, there is no need to use setXData to spread the points even on the x-axis.

Hope this can help.

Regards
Peter Kwan