c# Infragistics UltraChart LineChart

拈花ヽ惹草 提交于 2019-12-08 01:59:53

问题


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:


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


来源:https://stackoverflow.com/questions/4116199/c-sharp-infragistics-ultrachart-linechart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!