如何刷新oxyplot情节当数据变化 [英] How to refresh oxyplot plot when data changes

查看:471
本文介绍了如何刷新oxyplot情节当数据变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Oxyplot图它们是从6个用户输入文本框派生13分。在文本框中的值在MainWindow.xaml.cs类公共变量举行。当用户按下在文本框中输入的变量更新。我将如何做的刷新按钮刷新图表。

Oxyplot graphs 13 points which are derived from the 6 user input text boxes. The values in the text boxes are held in public variables in the MainWindow.xaml.cs class. The variables are updated when the user presses enter in the text box. How would I make the refresh button refresh the graph.

private void RefreshButton_Click(object sender, RoutedEventArgs e)
        {
            //Refresh The Graph
        }

我认为这会做使用

PlotModel.RefreshPlot() 

方法,但我不知道如何实现,因为Oxyplot穷人的文档了。

method, but I am not sure how to implement it because of Oxyplot's poor documentation.

推荐答案

我刚刚更新通过的NuGet OxyPlot的新版本。我使用OxyPlot.Wpf v20014.1.277.1我觉得你现在需要调用 InvalidatePlot(布尔了updateData) PlotModel ,而不是RefreshPlot(这不再可用)。我在我的示例代码测试这和它的工作如预期。

I just updated to a new version of OxyPlot via NuGet. I'm using OxyPlot.Wpf v20014.1.277.1 and I think you now need to call InvalidatePlot(bool updateData) on the PlotModel instead of RefreshPlot (which is no longer available). I tested this in my sample code and it worked as expected.

如果您想刷新情节的的更新数据收藏,您需要通过真正来调用:

If you want to refresh the plot and update the data collections, you need to pass true to the call:

PlotModel.InvalidatePlot(true)

这篇关于如何刷新oxyplot情节当数据变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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