Oxyplot graphs 13 points which are derived from the 6 user input text boxes. The values in
In the current OxyPlot.Wpf (1.0.0-unstable1983) you have two options:
Series.ItemsSource
property from XAML to a collection in your viewmodel and exchange the whole collection, when you need an update. This also allows for concurrent async updates with larger data sets.Plot.InvalidateFlag
property of type int
to your viewmodel and increment whenever you need an update. I haven't tested this approach, though.The following code illustrates both options (pick one). XAML:
Updates on the ViewModel:
private async Task UpdateAsync()
{
// TODO do some heavy computation here
List data = await ...
// option 1: Trigger INotifyPropertyChanged on the ItemsSource.
// Concurrent access is ok here.
this.DataSeries = data; // switch data sets
// option 2: Update the data in place and trigger via flag
// Only one update at a time.
this.DataSeries.Clear();
data.ForEach(this.DataSeries.Add);
this.InvalidateFlag++;
}