ASP.NET - Binding a DataTable to a line series
Posted: Wed Sep 03, 2008 5:13 pm
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:
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.
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.
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] );
Code: Select all
line1.Add( (DataTable) dtMyData );
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.