Filled Contour plot has empty regions

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
SurveyBob
Newbie
Newbie
Posts: 22
Joined: Mon Dec 14, 2009 12:00 am

Filled Contour plot has empty regions

Post by SurveyBob » Wed Feb 03, 2010 8:13 am

Hello,

I know there has been some discussion but the described problems and solutions in the forum didn't solve my problem.
I have a contour plot and set the FillLevels option set to true. Underneath with created a grid with different distances in x and z direction. So we set the IrregularGrid option to true as well.
For each grid point we interpolate a y value.

The problem is now that I still see regions where TChart does not fill out the chart or in other words I see white triangles. Our chart is updating its values by a timed procedure because the grid values are changing. So we calculate a new grid every time we got new values. However, the x and z value of the grid does not change, only the interpolated y value. The white triangles are always at another place in the chart. Sometimes they completely vanish which is good but they occur again at different places.

I increased the number of grid points by factor 10 and also played around with the Density property. But nothing helped.
So my question is now why do we still have white regions? Does this exclusively depend on the data or are there certain circumstances where it is impossible to fill out the chart?
What can we do to fill out the white regions?

Thanks for your help.

SurveyBob

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Filled Contour plot has empty regions

Post by Narcís » Wed Feb 03, 2010 10:58 am

Hi SurveyBob,

Is your problem the same as described here (TV52013073 - TF02014290)?

http://www.teechart.net/support/viewtop ... 073#p31048
http://www.teechart.net/support/viewtop ... 073#p40474

We have been investigating the issue but haven't found a solution without completely redesigning Contour and IsoSurface series.

If that's not the same problem please send us a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SurveyBob
Newbie
Newbie
Posts: 22
Joined: Mon Dec 14, 2009 12:00 am

Re: Filled Contour plot has empty regions

Post by SurveyBob » Wed Feb 03, 2010 1:47 pm

Hello Narcís,

yes, it seems to be the same problem since we have a perfectly drawn grid but still white triangles in it.
Would you say that the white triangles issue in the contour plot (filled) also occurs in the surface series?
Because if there is no problem in the surface plot we will try to make a catch there.

Another thing is that the filled contour areas show differences between the contour lines. The contour line is (lets say) round. Whereas the filled areas somehow follow a straight line and do not fit to the contour lines. The filled areas in the sample projects of TChart follows exactly the contour lines. So what are we doing wrong here?
I already changed the grid size, distance between the grid points, the PaletteSteps and NumRange property of the contour plot but nothing of them helped.

Many thanks for your help.

SurveyBob

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Filled Contour plot has empty regions

Post by Narcís » Wed Feb 03, 2010 2:06 pm

Hi SurveyBob,
yes, it seems to be the same problem since we have a perfectly drawn grid but still white triangles in it.
Would you say that the white triangles issue in the contour plot (filled) also occurs in the surface series?
Because if there is no problem in the surface plot we will try to make a catch there.
No, the problem doesn't exist with Surface series.
Another thing is that the filled contour areas show differences between the contour lines. The contour line is (lets say) round. Whereas the filled areas somehow follow a straight line and do not fit to the contour lines. The filled areas in the sample projects of TChart follows exactly the contour lines. So what are we doing wrong here?
I already changed the grid size, distance between the grid points, the PaletteSteps and NumRange property of the contour plot but nothing of them helped.
The problem is that Contour series internally uses an IsoSurface series for filling in the levels. That IsoSurface series doesn't know about Contour's levels. That's why you'll see that it doesn't take into account level points which are inside the cell area. Works fine for level points intersecting with cell borders. For example, TF02014290 can be reproduce using this code:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;

			Steema.TeeChart.Styles.Contour contour1 = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
			//contour1.IrregularGrid=true;
			contour1.FillLevels = true;
			contour1.UseColorRange = false;
			contour1.UsePalette = true;
			contour1.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Strong;

			Random y = new Random();

			for (int i = 0; i < 10; i++)
			{
				for (int j = 0; j < 25; j++)
				{
					contour1.Add(i, i * j - y.Next((int)Math.Round(0.5 * i * j)), j);
				}
			}

			tChart1.Axes.DrawBehind = false;
			tChart1.Axes.Left.Increment = 1;
			tChart1.Axes.Bottom.Increment = 1;
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SurveyBob
Newbie
Newbie
Posts: 22
Joined: Mon Dec 14, 2009 12:00 am

Re: Filled Contour plot has empty regions

Post by SurveyBob » Thu Feb 04, 2010 2:33 pm

Hello Narcís,

since the Filled Contour Chart is not the right thing for us we use a Color Grid. The actual Color Grid we created looks very nice and would fulfill our requirements.
Now here is the but:
We wanna use our own palette ranges, so the palette range should go from 0 to 60. The step size is 3. Therefore we have a summary amount of 20 steps, right?
The palette color shall go from red to blue. We fill the 20 palette color values with the specific color manually. After the color has been added I see in the debugger the perfectly added color which goes in even steps from red to blue. Everything's perfect till now.
However, the result (colorgrid) is drawing its own levels because everything beyond a certain level has the same color in the palette (legend). It seems that the palette is generated automatically and not the way we added the colors. While the contour plot has a property called "Automatic Levels" which we set to false when having our own palette in the contour plot (works superb), the color grid doesn't have such a property. My question is now how can we force the color grid to color each cell by our custom filled palette?
We use the same approach as in the contour map. The same workflow, the same color "picker" for the palette ranges. The contour line is drawn perfectly according to the used colors in the palette but not the color grid. What' s the magic here?

Thank you very much for your help and suggestions.

SurveyBob

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Filled Contour plot has empty regions

Post by Narcís » Thu Feb 04, 2010 2:38 pm

Hi SurveyBob,

Are you setting ColorGrid's custom palette as described here?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SurveyBob
Newbie
Newbie
Posts: 22
Joined: Mon Dec 14, 2009 12:00 am

Re: Filled Contour plot has empty regions

Post by SurveyBob » Thu Feb 04, 2010 3:26 pm

Hi Narcis,

I used the sample. That's what we have.

Code: Select all

// add data
// cg = colorgrid
cg.UseColorRange = true;
cg.UsePalette = true;
cg.ClearPalette();

cg.AddPalette( 0, Color.Orchid );
cg.AddPalette( 10, Color.Red );
cg.AddPalette( 20, Color.Purple );
cg.AddPalette( 30, Color.Plum );
cg.AddPalette( 40, Color.Peru );
cg.AddPalette( 50, Color.PapayaWhip );
cg.AddPalette( 60, Color.PaleTurquoise );
cg.AddPalette( 70, Color.PaleGoldenrod );

As you can see in the screenshot the palette has the right number of steps (7), but the color has not been applied. The red and blue comes from the desinger where we put in the StartColor, EndColor and MiddleColor. The values in the chart have a range of about 0.0 - 20.0. As soon as the values reach the end, the palette goes to red. So why is that because we manually set the color, right?

Thanks for your help.

SurveyBob
Attachments
Palette.png
Palette.png (1.21 KiB) Viewed 14137 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Filled Contour plot has empty regions

Post by Narcís » Thu Feb 04, 2010 3:59 pm

Hi SurveyBob,

The problem is you set UseColorRange to true, you should set it to false:

Code: Select all

			cg.UseColorRange = false;
Code below works fine for me here:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.ColorGrid cg = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

			for (int x = 0; x < 10; x++)
			{
				for (int z = 0; z < 10; z++)
				{
					cg.Add(x, x * z, z);
				}
			}

			cg.UseColorRange = false;
			cg.UsePalette = true;
			cg.ClearPalette();

			cg.AddPalette(0, Color.Orchid);
			cg.AddPalette(10, Color.Red);
			cg.AddPalette(20, Color.Purple);
			cg.AddPalette(30, Color.Plum);
			cg.AddPalette(40, Color.Peru);
			cg.AddPalette(50, Color.PapayaWhip);
			cg.AddPalette(60, Color.PaleTurquoise);
			cg.AddPalette(70, Color.PaleGoldenrod);
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SurveyBob
Newbie
Newbie
Posts: 22
Joined: Mon Dec 14, 2009 12:00 am

Re: Filled Contour plot has empty regions

Post by SurveyBob » Fri Feb 05, 2010 7:25 am

Hello Narcis,
thank you so much. This was the magic.
Kind regards,
SurveyBob

Post Reply