.Net图表控制自动滚动/禁用自动缩放
我目前正在构建一个用于绘制流数据图表的应用程序。我可以很好地接收数据点并将其添加到图表中,但是在添加每个点之后,图表会更改其比例以自动包含所有数据点(即,随着添加更多的点,这些点会变得更接近)。我怎样才能关闭它?
理想情况下,我希望图表简单地沿 x 轴滚动,而不是每次添加点时设置比例。最好的方法是什么?
以下是我用于在数据到达串行端口时添加数据点的代码:
chart1.Series["Series1"].Points.AddY(parsed);
该图只是默认的快速线图。以下是随时间变化绘制数据的图表的屏幕截图。正如您所看到的,它只是随着时间的推移压缩图表,而不是仅仅保留比例并向右滚动。
I am current building an application that graphs streaming data. I can receive and add data points to the chart just fine, but after every point is added, the graph alters its scale to include all the data points automatically(ie. the points get closer together as more are added). How can I turn this off?
Ideally, I would like the graph to simply scroll along the x axis rather than setting the scale each time a point is added. What is the best way to do this?
Here is the code I use for adding a data point as data arrives on the serial port:
chart1.Series["Series1"].Points.AddY(parsed);
The graph is just a default fast line plot. Here are screen captures of the graph plotting data over time. As you can see, it just compresses the graph over time rather than just leaving the scale alone and scrolling to the right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这将禁用自动缩放:
This will disable auto-scaling:
我通过以下方式完成此操作:
编辑是一个模拟,它在每个计时器刻度上添加点,最小值和最大值都会增加,因此显示的部分会增加,因此会发生滚动效果。
Iv'e done this in the following manner :
Edit is a mock which adds points on each timer tick the minimum and maximum values are incremented , so the part shown is incremented and so a scrolling effect occurs .