Populating contour, filled levels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
prle
Newbie
Newbie
Posts: 5
Joined: Mon Jun 02, 2008 12:00 am

Populating contour, filled levels

Post by prle » Fri Jan 23, 2009 12:45 am

I'm trying to use contour with filled levels in winforms using VS2008

Using contour.Add(double X, double Y, double Z), chart does not display the data.

When using contour.FillSampleValues(10) the chart displays the sample data, but I don't have the source code and can't step into this function to see how it populates the series.

namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//contour1.FillSampleValues(10);
}

private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
contour1.Add((double)j, (double)i/10, (double)i);
}
}

}
}
}

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

Post by Narcís » Fri Jan 23, 2009 10:29 am

Hi prle,

Such series work as I described here.

Anyway, in your code you just need to add:

Code: Select all

			contour1.FillLevels = true;
So that code below works fine for me here.

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.FillLevels = true;

			for (int i = 0; i < 10; i++)
			{
				for (int j = 0; j < 10; j++)
				{
					contour1.Add((double)j, (double)i / 10, (double)i); 
				}
			}
		}
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

prle
Newbie
Newbie
Posts: 5
Joined: Mon Jun 02, 2008 12:00 am

Populating contour, filled levels

Post by prle » Wed Jan 28, 2009 11:55 pm

Hi Narcis,

Thank you for the quick reply, your code works fine.

There are a couple more issues I found with contour series:

1. When I changed your code to add several points in irregular grid

Code: Select all

contour1.IrregularGrid = true;
contour1.Add(1.1, 0.25, 1.6);
contour1.Add(1.8, 0.15, 2.6);
contour1.Add(2.1, 0.5, 0.6);
the chart does not display any data, but both the bottom and left axis are scaled correctly. This is what I really need to display.

2. When I changed your code to add a single point using a single call to

Code: Select all

contour1.Add(1.1, 0.25, 1.6);
the chart does not display this point. I would expect a uniform colour across entire chart using either maximum or minimum level colour.

3. When contour1 is created at design time and FillLevels property is checked, using

Code: Select all

contour1.Add(...)
does not put the data on the chart.

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

Post by Narcís » Thu Jan 29, 2009 12:40 pm

Hi prle,
1. When I changed your code to add several points in irregular grid
Code:
contour1.IrregularGrid = true;
contour1.Add(1.1, 0.25, 1.6);
contour1.Add(1.8, 0.15, 2.6);
contour1.Add(2.1, 0.5, 0.6);

the chart does not display any data, but both the bottom and left axis are scaled correctly. This is what I really need to display.
The (X,Z) grid has to be evenly spaced, even in an irregular grid. You also need a minimum of 4 points to plot an irregular grid. In such circumstances you may better use a ColorGrid series. For example, this works:

Code: Select all

			tChart1.Aspect.View3D = false;
			Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
			colorGrid1.IrregularGrid = true;

			colorGrid1.Add(0.0, 1, 0.0);
			colorGrid1.Add(0.1, 1, 0.0);
			colorGrid1.Add(0.0, 1, 2.0);
			colorGrid1.Add(0.1, 1, 2.0);
With a Contour series code below also works:

Code: Select all

			tChart1.Aspect.View3D = false;
			Steema.TeeChart.Styles.Contour contour1 = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
			contour1.IrregularGrid = true;

			contour1.Add(1.1, 0.25, 0.6);
			contour1.Add(1.8, 0.15, 0.6);
			contour1.Add(2.5, 0.5, 0.6);
			contour1.Add(1.1, 0.25, 1.6);
			contour1.Add(1.8, 0.15, 1.6);
			contour1.Add(2.5, 0.5, 1.6);
			contour1.Add(1.1, 0.25, 2.6);
			contour1.Add(1.8, 0.15, 2.6);
			contour1.Add(2.5, 0.5, 2.6);
2. When I changed your code to add a single point using a single call to
Code:
contour1.Add(1.1, 0.25, 1.6);

the chart does not display this point. I would expect a uniform colour across entire chart using either maximum or minimum level colour.
Using a ColorGrid series this also works:

Code: Select all

			tChart1.Aspect.View3D = false;
			Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
			colorGrid1.IrregularGrid = true;

			colorGrid1.Add(1.1, 0.25, 1.6);
3. When contour1 is created at design time and FillLevels property is checked, using
Code:
contour1.Add(...)
does not put the data on the chart.
I'm not able to reproduce this here adding a Contour series, enabling Filled checkbox and populating a Contour series like this:

Code: Select all

			contour1.Add(1.1, 0.25, 0.6);
			contour1.Add(1.8, 0.15, 0.6);
			contour1.Add(2.5, 0.5, 0.6);
			contour1.Add(1.1, 0.25, 1.6);
			contour1.Add(1.8, 0.15, 1.6);
			contour1.Add(2.5, 0.5, 1.6);
			contour1.Add(1.1, 0.25, 2.6);
			contour1.Add(1.8, 0.15, 2.6);
			contour1.Add(2.5, 0.5, 2.6);
Which is the exact code you are using for populating contour series 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

prle
Newbie
Newbie
Posts: 5
Joined: Mon Jun 02, 2008 12:00 am

Populating contour, filled levels

Post by prle » Thu Jan 29, 2009 11:37 pm

Hi Narcis,

Thank you for the explanation. It seems that neither ColorGrid nor Contour are suitable for my application.

I need to display the fruit sweetness in geographic coordinates, where measurements are tagged using GPS. My X is longitude, Z is latitude, and data points are not evenly spaced. The operator can walk to any fruit on any tree to collect a sample. There can be any number of samples. The Y coordinate represents sweetness result using colour, and the chart should easily identify areas needing additional treatment such as fertilizer.

1. Can you suggest a suitable TeeChart series to display such data?

2. Can you please let me know what is the difference between setting the IrregularGrid property to true and false?

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

Post by Narcís » Fri Jan 30, 2009 11:15 am

Hi prle,

1. Can you suggest a suitable TeeChart series to display such data?
You could try using Bubble series. Its radius being X,Y geographic coordinates and Radius/Color values for sweetness.

If you need to plot additional areas here you may be interested in using Map series for plotting geographic coordinates too.
2. Can you please let me know what is the difference between setting the IrregularGrid property to true and false?
Yes, here I explained how IrregularGrid property should be used.
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

prle
Newbie
Newbie
Posts: 5
Joined: Mon Jun 02, 2008 12:00 am

Populating contour, filled levels

Post by prle » Mon Feb 02, 2009 4:36 am

Hi Narcis,

Thank you for the quick reply.

After having another look, the IrregularGrid property does not work as described in TeeChart help or in your description. I would like to report a bug: Contour does not work with IrregularGrid set to true.

According to the TeeChart help file, the IrregularGrid is a read/write property.

Code: Select all

public Boolean IrregularGrid {get; set;}
Description for IrregularGrid is "Determine if X and Z values are equi-distant or not"

In your description you added another two points:

"You need to set IrregularGrid property to true (by default set to false) in the following cases:
1. When X and Z intervals are not equidistant.
2. When X or Z intervals ire different from 1.
3. When X or Z intervals have negative values."

I don't see a design reason why the scattered X/Z points can't be shown as an irregular grid contour.

Also, my data fits the description stated in the help file, and your explanation, X and Z intervals are not equidistant, X or Z intervals are different from 1, X or Z intervals can have negative values.

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

Post by Narcís » Mon Feb 02, 2009 8:42 am

Hi prle,

Ok, I have added the issue (TF02013803) to the list to be investigated.
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

Post Reply