Irregular data for contour

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
VarUser
Newbie
Newbie
Posts: 23
Joined: Mon Sep 15, 2008 12:00 am

Irregular data for contour

Post by VarUser » Fri Aug 21, 2009 4:42 am

Hi

Is it possible to plot irregular data into contour plot.
The data which we are using is not a square or rectangular matrix.
eg

y-data
10 20 30 40
100 20
50 30 70 80 2

We are using contour.Add(x,y,z) overload.
"IrregularGrid" property is set to true.

The problems we are facing is when we zoom into some region the contours look disconnected.

Regards
- JS

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

Re: Irregular data for contour

Post by Narcís » Mon Aug 24, 2009 11:07 am

Hi JS,

Can you please attach a simple example project or post a code snippet 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

VarUser
Newbie
Newbie
Posts: 23
Joined: Mon Sep 15, 2008 12:00 am

Re: Irregular data for contour

Post by VarUser » Wed Aug 26, 2009 12:01 pm

Hi,
I have uploaded the ready to run sample application at "http://www.steema.net/upload"
User name : Varuser
Name of Application : ContourPlotSample.zip

1.Unzip the file.
2.run exe from debug folder.
3. Click "plot" button. (Entire data is loaded).
4. zoom some part of the series. (Check that contour is broken at many places)

We have also attached some snapshots depicting the problem.

Regards
selvakumar

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

Re: Irregular data for contour

Post by Narcís » Wed Aug 26, 2009 4:07 pm

Hi selvakumar,

Which exact TeeChart for.NET version are you using? I'm not able to load the data either using latest v3 nor latest v2009 release. Should I do anything special to load the chart? Or should I wait a lot of time for it to load?

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

VarUser
Newbie
Newbie
Posts: 23
Joined: Mon Sep 15, 2008 12:00 am

Re: Irregular data for contour

Post by VarUser » Thu Aug 27, 2009 6:32 am

Hi Narcís,

I have uploaded the sample project "ContourPlotSample.zip" on the same site.
We are using version 3 of TeeChart library (WPF).
No the application doesn't take much time to load.

Also for your reference,In the folder we have given three files of data which are x,y and z which we add in the chart.

Regards
- Selvakumar

VarUser
Newbie
Newbie
Posts: 23
Joined: Mon Sep 15, 2008 12:00 am

Re: Irregular data for contour

Post by VarUser » Thu Sep 03, 2009 12:31 pm

Hi Narcís

Any update on this. We have already uploaded the new application.

Regards
- JS

Marc
Site Admin
Site Admin
Posts: 1265
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Irregular data for contour

Post by Marc » Thu Sep 03, 2009 2:35 pm

Hello Selvakumar,

We think that the cause of the problem relates to data holes that you describe as possibly causing a problem. The inconsistencies in the data are easier to see if you limit the part of the chart/data you view.

For example, using your test data:

Code: Select all

for (int i = 0; i < y.Length; i++)
{
  for (int j = 0; j < y[i].Length - 1; j++)
  {
    float x1 = x[i][j];
    float y1 = y[i][j];
    float z1 = z[i][j];

    //cut down the Chart to an area of interest:
    if ((x1 < 2.06) && (x1 > 1.9) && (z1 > 1.46) && (z1 < 1.66)) //data zone with 'holes'
    {
      contour.Add(x1, Convert.ToDouble(y1), z1);
    }
  }
}
The level density for the reduced dataset shows more clearly some rectangular zones without plotted lines. We can zoom right in on one of the areas where we see the misssing plot, for example, using the following condition in place of the one we used last time:

Code: Select all

if ((x1 > 1.960) && (x1 < 1.99) && (z1 > 1.54) && (z1 < 1.56)) //hole area zoomed
..looking at the data that the Chart has received it shows a non-homogenous grid (ie. it doesn't have a value at all required x,z locations):

ie.
  • 1.98197996616364,-0.0290703102946281,1.55173301696777
    1.96242296695709,0.962698101997375,1.55173301696777
    1.98197996616364,0.40219309926033,1.54195404052734
    1.97220098972321,0.352497905492783,1.54195404052734
    1.96242296695709,0.195936396718025,1.54195404052734
where the X-Values are missing the 1,97220098972321 value at the 1,55173301696777 z location.

If we manually add that entry at that missing data location and re-run the Chart to test the hypothesis we'll see that it plots correctly:

eg.

Code: Select all

contour = AddContourtoChart();

contour.Add(1.98197996616364, -0.0290703102946281, 1.55173301696777);
contour.Add(1.97220098972321, 1.0372040271759, 1.55173301696777);           //<--- added missing entry
contour.Add(1.96242296695709, 0.962698101997375, 1.55173301696777);
contour.Add(1.98197996616364, 0.40219309926033, 1.54195404052734);
contour.Add(1.97220098972321, 0.352497905492783, 1.54195404052734);
contour.Add(1.96242296695709, 0.195936396718025, 1.54195404052734);
Please check your data and be sure that the grid is consistent throughout, taking an x value consistently at each z location and vice-versa. If your data is irregular you'll need to take a view on how to generate values, interpolating perhaps, for the missing locations.

Regards,
Marc Meumann
Steema Support

Post Reply