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

Message ListMessage List     Post MessagePost Message

  Cannot draw circle with XYchart
Posted by Michele on Apr-23-2022 21:58
I am using OSX 12.2 and ChartDirector 7. I created an XYchart in a C++ code with

XYChart *chart;
chart = new XYChart(width_chart, height_chart);

and then plotted a set of scattered data in the chart. So far, everything works. Now I would like to draw an spline with addSplineLayer (

However, the first argument of addSplineLayer is said to be 'An array of numbers representing the data set'. Instead of an array of numbers, I would need to enter an array of pairs of numbers, where each pair (x,y) is the given by abscissa and ordinate of the n-th point through which the spline will pass.

How may I plot an spline given an array of pairs (x,y) ?

Thank you for your help

  Re: Cannot draw circle with XYchart
Posted by Michele on Apr-24-2022 00:30
I am sorry, this post has obviously the wrong title

  Re: Cannot draw circle with XYchart
Posted by Peter Kwan on Apr-24-2022 17:42
Hi Michele,

You can plot a spline layer (or any other XY layers in ChartDirector) by provide an array for the x-coordinates and an array for the y coordinates. It is like:

SplineLayer *layer = c->addSplineLayer(DoubleArray(yDataPtr, yDataCount), ....);
layer->setXData(DoubleArray(xDataPtr, xDataCount));

The following is an example. It uses addLineLayer, but the same code works with addSplineLayer too:

Best Regards
Peter Kwan