Difficulty with Filled Contour Chart.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
GrayMoody
Newbie
Newbie
Posts: 5
Joined: Tue Jan 15, 2008 12:00 am

Difficulty with Filled Contour Chart.

Post by GrayMoody » Mon Jan 04, 2010 3:51 pm

I am working to implement a filled Contour chart. With "ThisCurve.FillLevels = false;" I get exactly what I want from a contour chart, except that it's not filled. However, with "ThisCurve.FillLevels = true;" the chart goes completely white, except for a red border and a red "X" drawn as lines from opposing corners. I've tried to use the example code for filled contour charts as much as possible. Any thoughts of what I should be looking for? Thanks!!

ThisCurve.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
//ThisCurve.Brush.Visible = true;
//ThisCurve.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
ThisCurve.ColorEach = false;
ThisCurve.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
ThisCurve.FillLevels = true;
ThisCurve.Marks.Brush.Visible = false;
ThisCurve.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
ThisCurve.Marks.Callout.ArrowHeadSize = 8;
ThisCurve.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
ThisCurve.Marks.Callout.Distance = 0;
ThisCurve.Marks.Callout.Draw3D = false;
ThisCurve.Marks.Callout.Length = 10;
ThisCurve.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
//ThisCurve.Marks.Callout.Visible = false;
ThisCurve.Marks.Transparent = true;
ThisCurve.Marks.Visible = true;
//ThisCurve.MidColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
ThisCurve.NumLevels = 8; //10;
ThisCurve.PaletteMin = 0;
ThisCurve.PaletteStep = 0;
ThisCurve.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Strong;
ThisCurve.Pen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
ThisCurve.Pen.Style = System.Drawing.Drawing2D.DashStyle.Dot;
ThisCurve.Pointer.HorizSize = 2;
ThisCurve.Pointer.Pen.Visible = false;
ThisCurve.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
ThisCurve.Pointer.VertSize = 2;


ThisCurve.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
ThisCurve.XValues.DataMember = "X";
ThisCurve.YValues.DataMember = "Y";
ThisCurve.YPosition = 0.18959828428699516;
ThisCurve.ZValues.DataMember = "Z";

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by Sandra » Tue Jan 05, 2010 10:17 am

I made a simple example using FillSampleValues() and FillLevels = true works correctly using last version of TeeChart .Net. Please, could you check if next code works correctly for you?

Code: Select all

       public Form1()
        {
            InitializeComponent();
        }
        private Steema.TeeChart.Styles.Contour ThisCurve;
        private void Form1_Load(object sender, EventArgs e)
        {
            tChart1.Aspect.View3D = false;
            ThisCurve = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
            ThisCurve.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
            ThisCurve.ColorEach = false;
            ThisCurve.FillSampleValues();
            ThisCurve.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
            ThisCurve.FillLevels = true;
            ThisCurve.Marks.Brush.Visible = false;
            ThisCurve.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
            ThisCurve.Marks.Callout.ArrowHeadSize = 8;
            ThisCurve.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
            ThisCurve.Marks.Callout.Distance = 0;
            ThisCurve.Marks.Callout.Draw3D = false;
            ThisCurve.Marks.Callout.Length = 10;
            ThisCurve.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
            ThisCurve.Marks.Transparent = true;
            ThisCurve.Marks.Visible = true;
            ThisCurve.NumLevels = 8; 
            ThisCurve.PaletteMin = 0;
            ThisCurve.PaletteStep = 0;
            ThisCurve.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Strong;
            ThisCurve.Pen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
            ThisCurve.Pen.Style = System.Drawing.Drawing2D.DashStyle.Dot;
            ThisCurve.Pointer.HorizSize = 2;
            ThisCurve.Pointer.Pen.Visible = false;
            ThisCurve.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
            ThisCurve.Pointer.VertSize = 2;
            ThisCurve.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
        }
If previous code works correctly but your application doesn’t work because you are working with database, I recommend make a simple example using DataSet as is explained, here and send us because we can reproduce your problem here.

Furthermore, you could say what is your actually version of TeeChart .Net.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

GrayMoody
Newbie
Newbie
Posts: 5
Joined: Tue Jan 15, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by GrayMoody » Tue Jan 05, 2010 3:00 pm

Thank you Sandra. The example program you sent works correctly and fills the contours, and my version is: TeeChart Pro 3.2.2945.19737. I am not using a database, but manually adding (x,y,z) info using the following code:

public void AddContourPoint(string CurveTitle, double x, double y, double z, Color pointColor)
{
Steema.TeeChart.Styles.Contour ThisCurve;
ThisCurve = (Steema.TeeChart.Styles.Contour)M_CurrentGraph.Series.WithTitle(CurveTitle);
ThisCurve.Add(x, y, z, pointColor);
}

I'll take a look at the Dataset example you linked, though if it's for database access, it may not be relevant.

I wonder if it could have to do with setting the pointColor. I may try a version that only does: ThisCurve.Add(x, y, z);

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

Re: Difficulty with Filled Contour Chart.

Post by Narcís » Tue Jan 05, 2010 3:14 pm

Hi GrayMoody,

Thanks for your feedback.

Also notice there are much newer builds of TeeChart for .NET v3 available at the client area.
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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by Dave » Thu Jan 14, 2010 10:51 am

Hi

Was GrayMoody's query ever solved? I have exactly the same problem in that when I use

myContour.FillSampleValues();

I get a filled contour chart OK as expected


But when I replace "myContour.FillSampleValues();" with my own code that builds up the contour ie. myContour.Add(x,y,z); then I DO NOT get the contour filled. It just shows grey contour lines. Is it possibly because the data doesn't lend itself to being filled? ie. My data is invalid in some way.

Note Ive tried with IrregularGrid = both true and false and the result is the smae in both cases.

GrayMoody
Newbie
Newbie
Posts: 5
Joined: Tue Jan 15, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by GrayMoody » Thu Jan 14, 2010 3:34 pm

No, my issue was not resolved yet, but I had to project shift to a different priority and haven't gotten back to it yet. Much like you, my code worked fine with FillSampleValues, and would fill the randomly generated contour graph. However, with my own values and FillLevels=true, I did not get any successful graph at all (it looked like a plain white backgroud with a red X crossing it). Interestingly enough, with my data and FillLevels=false, I got a very nice contour graph that accurately depicted my data, only it wasn't filled. I reached the same theory that you have. There must be something about my data which makes filling the contour impossible. But I have not had time to return to experiment further.

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

Re: Difficulty with Filled Contour Chart.

Post by Narcís » Thu Jan 14, 2010 3:45 pm

Hi GrayMoody and Dave,

Could you please attach 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

GrayMoody
Newbie
Newbie
Posts: 5
Joined: Tue Jan 15, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by GrayMoody » Thu Jan 14, 2010 3:59 pm

Narcis - thank you for helping, but I think I may need to explore more on my side first (when project demands allow me to). While I could send a sample app, I don't think it would help, because the sample apps work completely correctly, every time, on my end. My production app uses a spectrometer to supply data.

In the above posts, Sandra created a sample app, which is really a very close modelling of my actual code (kudos to Sandra). That app performs all functions correctly. The only difference is that Sandra's app uses random values and mine adds data point by point. In order to test whether it's my method for adding data, or the data itself, I'll need to find a means of modelling the spectrometer supplying data. I'm hoping to return to that project soon.
Last edited by GrayMoody on Thu Jan 14, 2010 4:08 pm, edited 1 time in total.

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

Re: Difficulty with Filled Contour Chart.

Post by Narcís » Thu Jan 14, 2010 4:04 pm

Hi GrayMoody,

Ok, thanks for your feedback. In that case the only thing it would help would be a sample application simulating spectrometer's data.
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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by Dave » Mon Feb 01, 2010 2:19 pm

Narcis
How do I upload my sample application (with XML data file) for you to look at.

Thanks.

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

Re: Difficulty with Filled Contour Chart.

Post by Narcís » Mon Feb 01, 2010 2:23 pm

Hi Dave,

You can attach it to this forums board. Under the text box you'll find a tab called "upload attachment". It's no necessary to include project's "bin" and "obj" folders.

Alternatively you can post your files to the upload page.

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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by Dave » Tue Feb 02, 2010 1:53 pm

Hi Narcis

Ive uploaded 2 files. Form.cs looks for the XML Ive uploaded.
Ive replaced your line "newContour.FillSampleValues();" with my code that uses the xml file to create a new contour.
As you can see nothing is rendered (but it renders OK if its not a filled contour just an ordinary contour)

Im wonderng if perhaps there is something invalid about the data that does not allow it to be drawn as a filled contour map.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Difficulty with Filled Contour Chart.

Post by Yeray » Tue Feb 02, 2010 4:23 pm

Hi Dave,

In your XML I can see 21 Line series but no Contour. Is that the correct file?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Re: Difficulty with Filled Contour Chart.

Post by Dave » Wed Feb 03, 2010 3:39 pm

Yeray
Im very sorry about that. I uploaded the wrong form.cs yesterday.
Ive just uploaded the correct one now. The xml file I sent yesterday is the correct one (the contour map is built up from the series in the xml file)

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

Re: Difficulty with Filled Contour Chart.

Post by Narcís » Mon Feb 08, 2010 10:24 am

Hi Dave,

Thanks for the example. The problem is that with such data you need to set Contour's IrregularGrid property to true:

Code: Select all

						newContour.IrregularGrid = true;
For more information on how to populate such series types and how IrregularGrid works please read this thread:

http://www.teechart.net/support/viewtop ... 750#p19750

Also, if you let me make a suggestion, IMHO it's much easier to understand and shorter to code populating Contour like this:

Code: Select all

						for (int a = 0; a < tChart1.Series.Count; a++)
						{
							for (int b = 0; b < tChart1[a].Count; b++)
							{
								double y1 = tChart1.Series[a].YValues[b];
								y1 = Math.Min(y1, threshold);
								newContour.Add(tChart1[a].XValues[b], y1, (50 + (a * 10)));
							}
						}
Hope this helps!
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