Displaying/Updating Contour using DataSource

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

Displaying/Updating Contour using DataSource

Post by Rajesh Dhiman » Tue Jul 21, 2009 11:11 am

Hi,

By looking properties of Contour class it seems that we can Display contours using DataSource Property.

Please let me know that how to prepare a DataTable or any other DataSource to Display the Contours.

The points on countour will go upto 1024x1024

I need to frequently update the Contours with high performance.
Using contour.Clear() and calls to Add() methods may be performance hit to the application.

so I think use of DataSource property will help and I will use CheckDataSource() method to update the contour on the chart, when ever data source changes.

Regards,

Rajesh Dhiman

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

Re: Displaying/Updating Contour using DataSource

Post by Narcís » Tue Jul 21, 2009 1:50 pm

Hi Rajesh,

Contour series should be populated as described here:

http://www.teechart.net/support/viewtop ... quidistant

Having that structure in mind you can a dataset at runtime as shown here:

http://www.teechart.net/support/viewtopic.php?t=8206
I need to frequently update the Contours with high performance.
Using contour.Clear() and calls to Add() methods may be performance hit to the application.
In that case I recommend you that you set TChart's AutoRepaint property to false before updating the chart, set it back to true when all changes are made and finally call TChart's Refresh method for it to be updated.

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

Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Re: Displaying/Updating Contour using DataSource

Post by Rajesh Dhiman » Wed Jul 22, 2009 1:19 pm

Hi,
Thanks for reply,

On reviewing T chart's code i found that using DataSource Property has no performance gain to call of Add() methods while displaying 1024x1024 points on contour. Because TChart internally performs the Contour.Clear() and making calls to Add() methods, with overheads of creating various dataviews from the Datatable.

Is there any other way to show 1024x1024 points on contour without making my application sluggish?

My application getting jerks when i am updating the contour data . When using checkdatasource() method for update, despite of setting the Autorepaint property to false and then to true.



Rajesh Dhiman

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

Re: Displaying/Updating Contour using DataSource

Post by Narcís » Thu Jul 23, 2009 12:55 pm

Hi Rajesh,

Yes, you can assing an array of doubles to Contour's ValueLists. You'll find an example of this at All Features\Welcome !\Speed\Fast Line Speed DrawAll in the features demo, available at TeeChart's program group.
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

Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Re: Displaying/Updating Contour using DataSource

Post by Rajesh Dhiman » Tue Jul 28, 2009 1:33 pm

Hi Is that correct way to populate a contour;

double[1024] xData = {1,2,3.....1024}

double[1024] zData = {1,2,3.....1024}

double[1024] [1024] yData = { {1,2,3.....1024},
{1,2,3.....1024},
{1,2,3.....1024},
.......
}

Contour contour = new Contour();

contour.XValues.Count= xData.Length;
contour.XValues.Values =xData;

contour.YValues.Count= yData.Length;
contour.YValues.Values =yData;

contour.ZValues.Count= zData.Length;
contour.ZValues.Values =zData;


Regards,
Rajesh

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

Re: Displaying/Updating Contour using DataSource

Post by Narcís » Tue Jul 28, 2009 2:25 pm

Hi Rajesh

Yes, that seems find to me. However you may need to add the Contour series to the chart if you are not doing it already, for example:

Code: Select all

Contour contour = new Contour(tChart1.Chart);
or:

Code: Select all

Contour contour = new Contour();
tChart1.Series.Add(contour);
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

Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Re: Displaying/Updating Contour using DataSource

Post by Rajesh Dhiman » Wed Jul 29, 2009 9:36 am

hi,

But in the above code compiler doesnot allow me to do the following statement

contour.YValues.Values =yData

error is I cannot asssign multi dimension array ([][]yData) to contour.YValues which is single dimension array

I am stuck up

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

Re: Displaying/Updating Contour using DataSource

Post by Narcís » Wed Jul 29, 2009 9:51 am

Hi Rajesh,

Oh yes, sorry, I missed that one. You need to provide an array for Y values similar to the ones you provide for X and Z values. You should follow principles I described in the forums thread I pointed, so, for example, if you plot a 3x3 grid you should have arrays like this:

X={1,1,1,2,2,2,3,3,3}
Y={5,6,1,7,2,9,3,4,8}
Z={1,2,3,1,2,3,1,2,3}
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

Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Re: Displaying/Updating Contour using DataSource

Post by Rajesh Dhiman » Thu Jul 30, 2009 7:01 am

Hi Narcís,

Thanks it worked, but it did not solved my original intention of increasing the performance of loading 1024x1024 points on the contour.

The only solution i think now is to reduce the number of points from my original dataset and give that decimated points to chart.

But sadly :( Tchart does not provide decimation for contour data.

If you could provide me any refernce or code for algorithms for contour data decimation that will be great. so that I can implement on my application.

I think with current performance of loading 1024x1024 points (Around 2mins on 2GB Ram m/c.) , my application will not pass acceptance test.


Regards,

Rajesh Dhiman

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

Re: Displaying/Updating Contour using DataSource

Post by Narcís » Thu Jul 30, 2009 7:31 am

Hi Rajesh,
But sadly :( Tchart does not provide decimation for contour data.
I'm not sure about what do you mean here, can you please elaborate on that? Contour series admits decimal values provided they are in a grid structure as explained in the thread I told you. Also, in such cases you'll need to set IrregularGrid=true.
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

Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Re: Displaying/Updating Contour using DataSource

Post by Rajesh Dhiman » Thu Jul 30, 2009 8:00 am

No No.. not that way..

I mean from decimation is Downsampling of contour data.

like in Fastline series downsamples data if we provide Downsampling object to functions property to reduce the number of points in series.

But Contour doesnot provides downsampling.

Rajesh

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

Re: Displaying/Updating Contour using DataSource

Post by Narcís » Thu Jul 30, 2009 9:09 am

Hi Rajesh

Ok, thanks for the info. I'm afraid Contour series and such series styles are not designed to work with such a big ammount of data. 1024x1024 grid would mean having over 1 million cells, 1048576 exactly. I'll add your request to the wish-list to be considered for inclusion in future releases.
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

Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Re: Displaying/Updating Contour using DataSource

Post by Rajesh Dhiman » Thu Jul 30, 2009 10:23 am

Exactly you got right now.

Is there any possibilty that you can provide downsampling algorithms to me so that i can implement by my way in my application.

or you can provide any references to it.

Thanks,

Rajesh

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

Re: Displaying/Updating Contour using DataSource

Post by Narcís » Thu Jul 30, 2009 10:26 am

Hi Rajesh,

You can use Red Gate's .NET reflector with TeeChart.dll to see which algorithms DownSampling function uses.
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