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

Message ListMessage List     Post MessagePost Message

  Spline Line chart with both X and Y values
Posted by Greg on Nov-15-2012 05:05
I have the following data...

double[] dataX = { 3.2, 2.9, 2.4, 2.1, 1.4 };
double[] dataY = { 5, 3.4, 3.2, 2, 1.8 };

I am trying to create a Spline Line chart that plots a point on the graph for each xy value,
then have the spline line go along these points.

My problem though is getting the points to plot correctly on the X axis.

I tried using layer.SetXData(dataX), this seems to work for one line. But if I have 2 sets of
XY data, the lines get all messed up, or rather the X data on the second line doesn't look
correct.

Please advise how I can create this simple graph to plot the x and y values with a spline
curve. If this is not possible with a spline curve, please explain how I could do it with a line
chart.

Thanks

  Re: Spline Line chart with both X and Y values
Posted by Peter Kwan on Nov-16-2012 00:23
Hi Greg,

You just need to add two spline layers for the two spline curves. For example:

SplineLayer0 layer0 = c.addSplineLayer(dataY0, ...);
layer0.setXData(dataX0);

SplineLayer0 layer1 = c.addSplineLayer(dataY1, ...);
layer0.setXData(dataX1);

If you think the spline does not look right, you may enter data symbols so you can see the data points:

layer0.getDataSet(0).setDataSymbol(Chart.CircleShape, 9);
layer1.getDataSet(0).setDataSymbol(Chart.DiamondShape, 9);

If you think the data points are not in the expected place, is it possible to attach the chart you obtain, and also the data you are using to plot the chart?

Regards
Peter Kwan