Plot Model not rising INotifyPropertyChanged event

Sep 30, 2013 at 2:07 PM
Hi, I've just discovered OxyPlot and it really looked like a great tool, but i'm having some trouble getting it up and running, specifically, when I update the plot model it does not rises the property changed event, and therefore it does not plot anything.

Here is the relevant xml
xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf"

<oxy:Plot Model="{Binding PlotData}" Margin="466,67,123,199"></oxy:Plot>
and the associated code to update PlotData
private PlotModel PlotData = new PlotModel();

            var temp = new PlotModel("Inter");
            var al1 = new OxyPlot.Series.LineSeries("Inter");

            for (int i = 0; i < Curve.GetLength(0); i++)
            {
                al1.Points.Add(new DataPoint(Curve[i, 1], Curve[i, 2]));
            }

            temp.Series.Add(al1);
            temp.Axes.Add(new OxyPlot.Axes.LinearAxis(OxyPlot.Axes.AxisPosition.Bottom, 0, maxX, "X Axis"));
            temp.Axes.Add(new OxyPlot.Axes.LinearAxis(OxyPlot.Axes.AxisPosition.Left, Min, Max, "Y Axis"));
            PlotData = temp;
I suspected that PlotData was not updating correctly, but if I do
Console.WriteLine(PlotData.ToString());
it correctly prints "Inter", if I call that same instruction before the assignment it prints a null line.

Can anyone help me to find my mistake?

Thanks a lot
Sep 30, 2013 at 4:44 PM
Use PlotData.RefreshPlot(true); when you want to update the plot. Good luck
Sep 30, 2013 at 9:53 PM
Hi, using your suggestion and setting the bindings to
<oxy:Plot Model="{Binding Source={StaticResource viewModel}, Path=PlotData}"  Margin="466,67,123,199"></oxy:Plot>
I got it to work.

Thank you very much!!