c# Infragistics UltraChart LineChart

2019-05-21 12:00发布

Can someone please provide a simple example of adding a line series to an UltraChart from a data table? The table has time series values (time values on x-axis, measurement (double) values on the y-axis).

So far the only examples I've seen where time series are added to the Chart are for a finite set of hard-coded datapoints. I want to be able to fee the data series from a selection in the table.

Any thoughts ideas and/or advice is greatly appreciated. Thanks, Ruben.

1条回答
劳资没心,怎么记你
2楼-- · 2019-05-21 12:56
  1. Define a Numeric Series

  2. Loop through each Data row in the Datatable

  3. Add Datapoints from the Datarow inside the loop NumericSeries.Points.Add(new NumericTimeDataPoint(System.DateTime.Parse(row["Date"]), row["value1"], "Label Name", false));

  4. Add the Series to the Chart

For Multiple Line Series create as many Series as you want with different columns.

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);
查看更多
登录 后发表回答