2010-11-07 95 views
2

有人可以提供一個簡單的例子,從數據表中添加一個系列的UltraChart?該表格包含時間序列值(x軸上的時間值,y軸上的測量(雙倍)值)。c#Infragistics UltraChart LineChart

到目前爲止,我所見過的將時間序列添加到圖表的唯一示例是有限的一組硬編碼數據點。我希望能夠從表中的選擇中收取數據系列。

任何想法的想法和/或建議,非常感謝。謝謝,魯本。

回答

1
  1. DataTable中

  2. 定義一個數字系列

  3. 遍歷每個數據行從數據行添加數據點的循環 NumericSeries.Points.Add(new NumericTimeDataPoint(System.DateTime.Parse(row["Date"]), row["value1"], "Label Name", false));

  4. 裏面的系列添加到圖表

對於多行系列,使用不同的列創建儘可能多的系列。

NumericTimeSeries waterDataSeries = null; 
foreach (DataRow currentRow in myDataTable.Rows) 
{ 
waterDataSeries.Points.Add(new NumericTimeDataPoint(Convert.ToDateTime(currentRow["Date"]), Convert.ToDouble(currentRow["qtyMeasure"]), "Water", false)); 
} 
Chart.Series.Add(waterDataSeries);