|
Intermediate values of spline curve |
Posted by Vassili on Jul-05-2013 21:05 |
|
Hello,
after plotting a spline curve for some given data, I would like to access y-values
on the spline curve for arbitrary x-value. I have not found any method to get this done. |
Re: Intermediate values of spline curve |
Posted by Peter Kwan on Jul-05-2013 23:11 |
|
Hi Vassili,
Unluckily, ChartDirector does not really have the information you need.
In drawing the spline curve, ChartDirector does not try to fit a spline using the data values. Instead, it fits the spline to the pixel position of the data points, and it is only approximate (with around +/- 0.5 pixel of error). In some cases, the spline is not even fitted by ChartDirector. (For example, in SVG, ChartDirector may just tell the browser to use a spline to join the points, and the spline is actually rendered by the browser.) Also, ChartDirector does not remember or keep track of everything that it has ever done. So after drawing the spline, it will free the memory and no longer have the information.
If you need to obtain the y value given the x value, you would need to compute it with your own code. The spline curve created by ChartDirector is a standard cardinal spline, and can be computed with a standard method. See:
http://en.wikipedia.org/wiki/Cubic_Hermite_spline
Regards
Peter Kwan |
|