Page 1 of 1

ASP.NET - Binding a DataTable to a line series

Posted: Wed Sep 03, 2008 5:13 pm
by 13049723
Hi,

I have set up a ASP.NET page with a single WebChart. I have added a series to the WebChart of type line. I run a SQL query and get a dataset back which consists of 2 fields, a date and a measurement. When I add the series manually by using the Add method eg:

Code: Select all

line1.Add( (DateTime) dtMyDate[i], (double) myMeasurement[i] );
and loop it until I add all the measurements, it works beautifully! When I copy the data I want to a DataTable and use the overloaded method of Add with a DataTable or DataView, it will not work.

Code: Select all

line1.Add( (DataTable) dtMyData );
The 1st column is a DateTime and the 2nd column is a Double. My website is slow and needs optimization, I'm trying to plot roughly 2000 points per series with 4 series.

Adding it in a loop works but it's not optimized. I'd like to drop a chunk of data and not have so many jumps and conditional branching occurring on the server if possible.

Also, in your tutorials it says the ASP.NET WebChart uses a similar data binding technique as in the Windows form. How do I get a OleDbDataAdapter to be recognized by the WebChart component at design time in an ASP.NET session? It's not available in the toolbox. I can declare and add it to my code, but it will only get instantiated at runtime. Sorry if this is a stupid question, I'm still learning ASP.NET I am used to C/C++/Java embedded firmware development.

Posted: Thu Sep 04, 2008 7:50 am
by narcis
Hi TlcDev,

I recommend you to read the forums threads below about this subject.

http://www.teechart.net/support/viewtopic.php?t=3337
http://www.teechart.net/support/viewtopic.php?t=3416

You may also be interested in using DataTable as shown here:

http://www.teechart.net/support/viewtopic.php?t=8206

Hope this helps!