2

有人可以提供一个从数据表向 UltraChart 添加线系列的简单示例吗?该表具有时间序列值(x 轴上的时间值,y 轴上的测量(双精度)值)。

到目前为止,我看到的将时间序列添加到图表的唯一示例是针对一组有限的硬编码数据点。我希望能够从表格中的选择中收取数据系列费用。

非常感谢任何想法和/或建议。谢谢,鲁本。

4

1 回答 1

1
  1. 定义数字系列

  2. 循环遍历数据表中的每个数据行

  3. 从循环内的 Datarow 添加数据点 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);
于 2011-05-12T08:40:24.513 回答