Plot Model not rising INotifyPropertyChanged event

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

eZegpi wrote at 2013-09-30 15:07:

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

everytimer wrote at 2013-09-30 17:44:

Use PlotData.RefreshPlot(true); when you want to update the plot. Good luck

eZegpi wrote at 2013-09-30 22:53:

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!!