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

Message ListMessage List     Post MessagePost Message

  Contour chart - problem with colors
Posted by Serge on Nov-26-2011 01:39
Attachments:
Hi,

For some reasons a contour chart is not rendered correctly sometimes. Please see "bad.png" - the yellow color at Y=12 is rendered as some noise.

If I call setSmoothInterpolation(true), the problem goes away (good1.png)

Another way to fix colors is to hide contour lines (good2.png), i.e.
   setSmoothInterpolation(false)
   setContourColor(transparent)

data.txt contains the data values used to produce the chart.
data.txt
x:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23
y:0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,13,14,15,16,17,21,24,0,1,7,8,9,10,11,12,14,15,16,17,21,24,0,1,3,6,7,8,9,10,11,12,14,15,16,17,20,21,23,24,0,1,3,6,7,8,9,10,11,12,14,15,16,17,20,21,23,24,0,1,3,6,7,8,9,10,11,12,14,15,16,17,20,21,23,24,0,1,3,6,7,8,9,10,11,12,14,15,16,17,20,21,23,24,0,1,3,6,7,8,9,10,11,12,14,15,16,17,20,21,23,24,0,1,3,6,7,8,9,10,11,12,13,14,15,16,17,20,21,23,0,1,3,6,7,8,10,11,12,13,14,15,16,17,20,21,23,0,1,3,6,7,8,10,11,12,13,14,15,16,17,20,21,23,0,6,7,8,9,10,11,12,13,14,15,16,20,21,23,0,6,7,8,9,10,11,12,13,14,15,16,20,23,0,6,7,8,9,10,11,12,13,14,15,16,20,23,0,6,7,8,9,10,11,12,13,14,15,16,20,23,0,6,7,8,9,10,11,12,13,14,15,16,20,23,0,6,7,8,9,10,11,12,13,14,15,16,20,23,0,6,7,8,9,10,11,12,13,14,15,16,20,23
z:20,19,11,17,34,12,30,30,30,19,18,18,18,14,27,20,19,11,17,34,19,30,30,30,19,18,18,19,14,27,20,19,11,17,34,20,30,30,30,19,18,18,19,14,27,20,19,11,17,34,20,30,30,30,19,19,18,19,14,27,20,19,11,17,34,20,30,30,30,19,19,18,19,14,27,20,19,11,17,34,20,30,30,30,19,18,18,18,14,27,20,19,11,17,34,20,30,30,30,19,18,18,18,14,27,20,19,11,17,34,20,30,30,30,19,19,19,23,14,27,20,19,11,17,34,24,30,30,19,19,19,26,14,27,20,19,1,1,11,17,34,30,30,30,19,19,19,26,1,25,19,27,20,19,2,1,16,17,34,30,30,30,19,18,19,26,1,30,26,27,19,21,2,1,17,17,34,30,30,30,19,18,19,26,1,30,27,27,19,26,2,1,17,17,34,30,30,30,19,19,19,26,1,30,28,27,19,26,9,1,17,20,34,30,30,30,19,19,19,26,1,30,28,27,19,26,10,1,17,25,34,30,30,30,1,19,18,19,26,1,30,27,19,26,14,1,17,25,30,30,30,1,19,18,19,26,1,31,27,19,26,20,1,17,25,30,30,30,1,19,19,19,26,1,33,27,19,1,17,25,12,30,30,30,1,19,18,18,8,36,27,19,1,17,33,12,30,30,30,10,19,18,18,14,27,19,1,17,34,12,30,30,30,19,19,18,19,14,27,19,1,17,34,12,30,30,30,19,19,18,19,14,27,19,2,17,34,12,30,30,30,19,19,19,19,14,27,19,9,17,34,12,30,30,30,19,19,19,19,14,27,19,11,17,34,12,30,30,30,19,19,19,18,14,27
bad.png
good1.png
good2.png

  Re: Contour chart - problem with colors
Posted by Peter Kwan on Nov-28-2011 18:02
Hi Serge,

In ChartDirector, the contour at z=30 refers to points that are at z=30, the contour line at z=20 refers to points that are at z=20, etc..

An issue occur if there is a flat region exactly at z=30. In this case, the entire region will become the contour. So instead of being a line, the contour will become a flat region.

In your chart, it appears near y=12, there is an almost flat region at z=30. So near y=12, you see a much darker region, which is the contour at z=30.

The problem only occurs in non-smooth interpolation (linear interpolation), because in linear interpolation, if the 4 corners of a cell are all at z=30, the region must be completely flat at z=30. For smooth interpolation (spline interpolation), the region in a cell will also be affected by points further away, and so may not be completely flat at z=30 for your case.

Of course, if you do not draw the contour, the problem will not occur.

To address the issue in the currently version of ChartDirector, we suggest people to multiple all their z data values by 0.9991736592 (just some random number very close to 1) before passing them to ChartDirector. As the changes to the data values are very small, they will not be visible in a contour chart. With the changes, it is extremely unlikely that any data point will be at an exact contour level, and so avoiding an entire region being filled with the contour color.

(In the next version of ChartDirector, the contour algorithm will be changed. The z=30 contour no longer represents the points at z=30. Instead, it represents the transitions between z=30 and z!=30.)

Regards
Peter Kwan

  Re: Contour chart - problem with colors
Posted by Serge on Nov-28-2011 21:56
Hi Peter,

Thanks you for the very detailed answer. I will try your suggestion.

Serge