【问题标题】:c# Infragistics UltraChart LineChartc# Infragistics UltraChart LineChart
【发布时间】:2010-11-07 02:09:40
【问题描述】:

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

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

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

【问题讨论】:

    标签: c# infragistics charts graphing


    【解决方案1】:
    1. 定义数字序列

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-11
      • 2012-12-13
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-05
      • 2017-06-16
      相关资源
      最近更新 更多