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

Message ListMessage List     Post MessagePost Message

  ScatterSurface chart
Posted by Eyal on Sep-14-2011 20:09
Attachments:
Hi,
I am trying to make Scattersurface chart via the below array points and i am getting chart which displays negative z:
double[] dataX = {0.215, 0.26, 0.4275, 0.47, 0.728347826086956, 0.7, 0.7, 0.74, 0.739615384615385, 0.7};
double[] dataY = {2.27, 2.27, 2.27, 2.27, 2.27, 2.27, 2.27083333333333, 2.269, 2.27215384615385, 2.27};
double[] dataZ = {2.0, 1.0, 2.0, 1.0, 23.0, 2.0, 6.0, 3.0, 13.0, 1.0}; (z from 1 to 23)

During testing i saw that if there is only one number after point it works fine.
Please let me know your ideas and thoughts on this subject.
Thanks,
Eyal
New Bitmap Image.jpg

  Re: ScatterSurface chart
Posted by Peter Kwan on Sep-15-2011 00:24
Attachments:
Hi Eyal,

In your case, your code are using "spline surface interpolation" (the default) to create the surface. Basically it means ChartDirector would need to obtain a "smooth surface" that passes through your data points. For "smooth surface", it is normal that it can "overshoot" or "undershoot" your data range. In other words, the surface itself can rise above the highest data point, and drops below the lowest data point.

I have attached an image to help explain "spline interpolation". The image shows 2D interpolation but the same results applies to 3D as well. In the image, you can see that the spline curve overshoots the data points (the peak of the spline curve is above the highest data point). The spline curve is perfectly normal and natural, in that if you bend a plastic ruler so that it passes through all the data points, the ruler will assume a similar shape. This shows it is normal and natural for a smooth surface to overshoot or undershoot the data points.

Therefore, even if all your data points are positive, it is normal and possible the surface itself contains negative parts, as the surface can undershoot the data points.

For your case, if you do not want the surface to go below your lowest data point (or to go below 0), you may:

(a) Use bilinear interpolation instead of spline surface interpolation. You can see in the attached image that linear interpolation neven overshoots or undershoots. The code is like:

//use the following line to replace your existing setInterpolation line
c.setInterpolation(50, 50, false);

(b) Explicitly specify that the lower bound of the z-axis is 0. ChartDirector will then plot the negative part of the surface at z = 0.

c.zAxis().setLinearScale(0, Chart.NoValue);

Hope this can help.

Regards
Peter Kwan
Spline_Overshoot_Demo.png