MSDN 图表实时更改点值? [英] MSDN charts changing point values realtime?

查看:19
本文介绍了MSDN 图表实时更改点值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 MSDN 图表来表示我从 telnet 应用程序获取的实时数据.出于测试目的,我添加了一个按钮来手动更改图表.我手动制作了图表,它在 X 轴上有 0 到 5 个点,X 上的值不同.该系列以其默认的系列 1"命名.

I want to use MSDN charts to represent realtime data i'm getting from a telnet application. For testing purpose i have added a button to alter the chart manually. I manually made the chart and it has 0 to 5 points on the X axis with values different values on the X. The series is named by it's default "Series1".

我尝试了以下方法:

chart1.Series["Series1"].Points.ElementAt(0).SetValueY(40);//什么都没发生

chart1.Series["Series1"].Points.ElementAt(0).SetValueY(40); //Nothing happens

chart1.Series["Series1"].Points.ElementAt(1).SetValueXY(1, 20);//什么都没发生

chart1.Series["Series1"].Points.ElementAt(1).SetValueXY(1, 20); //Nothing happens

chart1.Series["Series1"].Points[0].SetValueY(40);//什么都没发生

chart1.Series["Series1"].Points[0].SetValueY(40); //Nothing happens

chart1.Series["Series1"].Points.ElementAt(1).YValues.SetValue(10, 0);//什么都没发生

chart1.Series["Series1"].Points.ElementAt(1).YValues.SetValue(10, 0); //Nothing happens

chart1.Series["Series1"].Points.Clear();//删除所有的点.

chart1.Series["Series1"].Points.Clear(); //Removes all points like it should.

那么如何在运行时更改数据点条目?

So how do i change datapoint entries on runtime?

-编辑-如果我使用 chart1.Series["Series1"].Points.ElementAt(0).SetValueY(40); 修改一个点并在此之后添加一个点 chart1.Series["Series1"].Points.AddXY(1, 40); 修改后的点确实会卡入它的修改位置.结论是修改确实改变了点 Y 值,但图形不会刷新.AddXY() 函数似乎会自动刷新.我似乎找不到手动调用 Refresh() 的方法.

-EDIT- If i modify a point using chart1.Series["Series1"].Points.ElementAt(0).SetValueY(40); and add a point after this with chart1.Series["Series1"].Points.AddXY(1, 40); the modified point does snap into it's modified place. The conclusion is that modifying does change the points Y value but the graph does not get refreshed. The function AddXY() seems to autorefresh. I cannot seem to find a way to call Refresh() manually.

推荐答案

改变值后调用chart1.Refresh();它将强制重新绘制图表,选取新值.

Call chart1.Refresh() after changing the value; it will force a redraw of the chart, picking up the new values.

这篇关于MSDN 图表实时更改点值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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