Page 1 of 1
Displaying/Updating Contour using DataSource
Posted: Tue Jul 21, 2009 11:11 am
by 13050301
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
Re: Displaying/Updating Contour using DataSource
Posted: Tue Jul 21, 2009 1:50 pm
by narcis
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!
Re: Displaying/Updating Contour using DataSource
Posted: Wed Jul 22, 2009 1:19 pm
by 13050301
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
Re: Displaying/Updating Contour using DataSource
Posted: Thu Jul 23, 2009 12:55 pm
by narcis
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.
Re: Displaying/Updating Contour using DataSource
Posted: Tue Jul 28, 2009 1:33 pm
by 13050301
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
Re: Displaying/Updating Contour using DataSource
Posted: Tue Jul 28, 2009 2:25 pm
by narcis
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);
Re: Displaying/Updating Contour using DataSource
Posted: Wed Jul 29, 2009 9:36 am
by 13050301
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
Re: Displaying/Updating Contour using DataSource
Posted: Wed Jul 29, 2009 9:51 am
by narcis
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}
Re: Displaying/Updating Contour using DataSource
Posted: Thu Jul 30, 2009 7:01 am
by 13050301
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
Re: Displaying/Updating Contour using DataSource
Posted: Thu Jul 30, 2009 7:31 am
by narcis
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.
Re: Displaying/Updating Contour using DataSource
Posted: Thu Jul 30, 2009 8:00 am
by 13050301
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
Re: Displaying/Updating Contour using DataSource
Posted: Thu Jul 30, 2009 9:09 am
by narcis
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.
Re: Displaying/Updating Contour using DataSource
Posted: Thu Jul 30, 2009 10:23 am
by 13050301
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
Re: Displaying/Updating Contour using DataSource
Posted: Thu Jul 30, 2009 10:26 am
by narcis
Hi Rajesh,
You can use
Red Gate's .NET reflector with TeeChart.dll to see which algorithms DownSampling function uses.