c#Infragistics UltraChart LineChart
有人可以提供一个从数据表中向UltraChart添加一个系列的简单示例吗? 该表具有时间序列值(x轴上的时间值,y轴上的测量(双)值)。
到目前为止,我看到的时间序列添加到图表中的唯一示例是针对一组有限的硬编码数据点。 我希望能够从表格中的选择中收取数据系列。
任何想法的想法和/或建议都非常感谢。 谢谢,鲁本。
-
定义数字系列
-
遍历Datatable中的每个Data行
-
从循环内的
NumericSeries.Points.Add(new NumericTimeDataPoint(System.DateTime.Parse(row["Date"]), row["value1"], "Label Name", false));
添加数据点NumericSeries.Points.Add(new NumericTimeDataPoint(System.DateTime.Parse(row["Date"]), row["value1"], "Label Name", false));
-
将系列添加到图表中
对于多行系列,可以根据需要使用不同的列创建多个系列。
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);