|
How to deal the Float.NaN |
Posted by Lizhi on Jan-21-2010 18:38 |
|
I want to know how to deal with the Float.NaN when use the ContourLayer.
There are some missing data in my dataset. I give the missing data value for Float.NaN. I want the missing data area to be a blank space.
How can I do this?
thanks |
Re: How to deal the Float.NaN |
Posted by Peter Kwan on Jan-21-2010 23:32 |
|
Hi Lizhi,
For a missing point, there are two methods:
(a) You may remove the point before passing the data to ChartDirector. In other words, you may pass only valid points to ChartDirector.
(b) You may use Chart.NoValue to representing a missing value.
A missing point may or may not leave a "blank space". A point is a zero dimension object and does not occupy space on its own. It is the relationship of the point to other points that occupy space.
I have attached a contour chart example to help to explain the effect of a missing point. If the point is in the middle of the filled region will not change the boundary of the filled region. It will only change the colors and the contours within the filled region.
If the point happens to be at the boundary of the filled region (the boundary is the convex hull of the data points), removing that point will shrink the region.
Hope this can help.
Regards
Peter Kwan
|
Re: How to deal the Float.NaN |
Posted by lizhi on Jan-22-2010 00:41 |
|
Hi Peter,
Thank you very much for you quick answer.
I want to use the contour and surface chart to display 2D dataset. The data is regular gridded value as NX * NY. At some grid points, the data is missed and should not be interpolated by other points nearby. I want the contour or the surface should tell me the truth: there are some missed data at some grid point.
How can I do this with ChartDirector?
Thanks,
Regards,
lizhi |
Re: How to deal the Float.NaN |
Posted by Peter Kwan on Jan-22-2010 13:09 |
|
Hi lizhi,
Unluckily, ChartDirector cannot support a contour surface with holes in it.
May be you can add something (like a white square) to hide the region. For example, you may try to add a bubble layer with a rectangular or square bubble in front of the contour layer to block the part you do not want to see. See the "Bubble XY Scaling" sample code on how to create a bubble layer with rectangular bubbles.
Hope this can help.
Regards
Peter Kwan |
Re: How to deal the Float.NaN |
Posted by lizhi on Jan-24-2010 10:51 |
|
Hi Peter,
Thank you for your rapidly reply.
Will ChartDirector support a contour surface with holes in it in the future?
Regard
lizhi |
Re: How to deal the Float.NaN |
Posted by Slava on Apr-06-2010 02:45 |
|
Peter Kwan wrote:
Unluckily, ChartDirector cannot support a contour surface with holes in it. It's a problem for some customers. Contour overlays are really useless now to produce GroundOverlays for Google Maps. I see no great problem to implement "true" contours with holes, and some options to manage missing values. |
Re: How to deal the Float.NaN |
Posted by Peter Kwan on Apr-06-2010 03:14 |
|
Hi Slava,
If you know exactly where are the holes, it is possible to draw a contour layer with holes.
A chart with holes are different from a chart with missing values, because the missing values do not define the holes. For example, consider the scatter contour chart example in this thread, if one of the points is NoValue, one can argue there is a hole, but we do not know how large is the hole. If 5 nearby points are NoValue, we do not know if there are 5 separate holes or just 1 big hole.
If you know exactly where are the holes (which means you know the vertices of the polygons that defines the holes), the method is to clip the contour chart using the polygons, or just paint the polygons over the contour chart using the background color as the fill color. (The API to paint a polygon is DrawArea.polygon.)
Hope this can help.
Regards
Peter Kwan |
|