C#Infragistics UltraChart LineChart [英] c# Infragistics UltraChart LineChart

查看:350
本文介绍了C#Infragistics UltraChart LineChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

遍历数据表中的每个数据行

Loop through each Data row in the Datatable

从循环内的数据行添加数据点 NumericSeries.Points.Add(new NumericTimeDataPoint(System.DateTime.Parse(row["Date"]), row["value1"], "Label Name", false));

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

将系列添加到图表

对于多行系列,请使用不同的列创建任意数量的系列.

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

这篇关于C#Infragistics UltraChart LineChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆