DataEngine: multiple series from different DB Columns.

Expand / Collapse
 

DataEngine: multiple series from different DB Columns.


QUESTION

How can I create multiple series from different DB Columns?

ANSWER

For version 3.1 and up, please see this help topic.

---

Another way to do this is to query your database separately for each series.

[C#]

DataEngine de = new DataEngine(connectionString);
de.SqlStatement = "SELECT name, dataOne FROM table";
Chart.SeriesCollection.Add(de.GetSeries());

de.SqlStatement = "SELECT name, dataTwo FROM table";
Chart.SeriesCollection.Add(de.GetSeries());
 

 
[Visual Basic]

Dim de As New DataEngine(connectionString)
de.SqlStatement = "SELECT name, dataOne FROM table"
Chart.SeriesCollection.Add(de.GetSeries())

de.SqlStatement = "SELECT name, dataTwo FROM table"
Chart.SeriesCollection.Add(de.GetSeries())
 

If querying the database multiple times is not desirable this can be accomplished by using a DataTable.

[C#]

DataEngine de = new DataEngine();
DataTable dt = new DataTable();
// Populate the datatable from your database.
dt = (...);
de.Data = dt;
de.DataFields = "YAxis=name,XAxis=DataOne";
Chart.SeriesCollection.Add(de.GetSeries());

de.DataFields = "YAxis=name,XAxis=DataTwo";
Chart.SeriesCollection.Add(de.GetSeries());
 

 
[Visual Basic]

Dim de As New DataEngine()
Dim dt As New DataTable()
' Populate the datatable from your database.
dt = (...)
de.Data = dt
de.DataFields = "YAxis=name,XAxis=DataOne"
Chart.SeriesCollection.Add(de.GetSeries())

de.DataFields = "YAxis=name,XAxis=DataTwo"
Chart.SeriesCollection.Add(de.GetSeries())
 



Rate this Article:
     

Add Your Comments


Comment require login or registration.

Details
Last Modified:Wednesday, August 11, 2010
Last Modified By: Support
Type: HOWTO
Rated 2 stars based on 33 votes.
Article has been viewed 15,324 times.
Options