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())
 


Posted Friday, April 9, 2004 by Support
https://dotnetcharting.com/kb/KnowledgebaseArticle10051.aspx