How to refresh oxyplot plot when data changes

前端 未结 7 1345
予麋鹿
予麋鹿 2021-02-07 02:10

\"GUI

Oxyplot graphs 13 points which are derived from the 6 user input text boxes. The values in

相关标签:
7条回答
  • 2021-02-07 03:00

    The cleanest way I've found to get "sort of" auto-update is reacting to CollectionChanged on the collection that is LineSeries' ItemsSource.

    In ViewModel:

    ObservableCollection<DataPoint> Data { get; set; } 
        = new ObservableCollection<DataPoint>();
    
    public PlotModel PlotModel
    {
        get { return _plot_model; }
        set
        {
            _plot_model = value;
            RaisePropertyChanged(() => PlotModel);
        }
    }
    PlotModel _plot_model;
    
    // Inside constructor:
    Data.CollectionChanged += (a, b) => PlotModel.InvalidatePlot(true);
    
    0 讨论(0)
提交回复
热议问题