Unable to update OxyPlot chart after initialization

I have an OxyPlot diagram defined in my XAML, for example:

<oxy:Plot Height="336">
    <oxy:Plot.Series>
        <oxy:LineSeries ItemsSource="{Binding Chart}"/>
    </oxy:Plot.Series>
</oxy:Plot>

In viewModel, I have the following:

public ObservableCollection<DataPoint> Chart { get; private set; }

public MainViewModel()
{
    Chart = new ObservableCollection<DataPoint>() 
            { new DataPoint(12, 14), new DataPoint(20, 26) };

    public void PriceChange(Model[] quotes)
    {
        for (int i = 0; i < quotes.Length; i++)         
        {
            Chart.Add(new DataPoint(quotes[i].LastTradePrice, i*10));          
        }
    }
}

I can see the initial graph drawn for the first two hard-coded DataPoints.

But after everything is over and the method PriceChange()starts, new data is not displayed on the chart. Since its onbervableCollection it should automatically notify the user interface, right? Or what am I missing?

BTW I have the following example in the documentation.

+3
source share
2 answers

Chart ObservableCollection , , / , , .

OxyPlot, , Plot InvalidatePlot(), , , - , , . , , , .

, :

http://oxyplot.codeplex.com/discussions/398856

http://oxyplot.codeplex.com/discussions/352003

, :

http://oxyplot.codeplex.com/SourceControl/latest#Source/Examples/WPF/WpfExamples/Examples/CoupledAxesDemo/

Edit:

, , PlotModel Model , PlotModel:

oxyplot.codeplex.com/SourceControl/latest#Source/Examples/WPF/WpfExamples/Examples/RealtimeDemo/

+1

:

<oxy:Plot InvalidateFlag="{Binding DataPoints.Count, Delay=20}">
    <oxy:Plot.Series>
        <oxy:LineSeries ItemsSource="{Binding DataPoints}"/>
    </oxy:Plot.Series>
</oxy:Plot>

Delay , .

+4

All Articles