Question about accessing the plot in MVVM

Mar 15, 2014 at 4:16 AM
My plot is created entirely in the view and is bound with data from the view model. When the data sets that are bound, my plot is not refreshing to redraw the data within the correct scale if I zoom or toggle the visibility of a line. So my question is how can I make sure that my graph resets to the correct size when I have zoomed or panned? If I press 'A' to reset the view before I switch the data binding the graph behaves correctly, it is just in the case when I do anything to the graph.

Any help is greatly appreciated and I hope I explained this question thoroughly.
Mar 26, 2014 at 5:56 PM
The real question I have is how can I access the plot that is entirely set up in the xaml, through my view model, because I need to refresh the plot when the data set changes so that they axises update correctly when the data changes.
Mar 26, 2014 at 7:21 PM
Why you set up the plot in XAML when using MVVM?
Mar 26, 2014 at 8:25 PM
The Plot control has an InvalidatePlot method that can be called to invalidate and update the data.
There is also a command binding on the Plot.ResetAxesCommand command (I think this should be refactored to PlotCommands.ResetAxes)
You can also bind to the InvalidateFlag property - when the value is changed the plot is invalidated. I am not sure if this is a good feature, would like to get feedback on this one..
I think it is possible to use an attached property if you want to bind to the actual PlotModel.
Mar 26, 2014 at 8:35 PM
The command is changed to PlotCommands.ResetAxes. See example in the "ExportDemo".
Mar 27, 2014 at 3:06 PM
Thank you for the answer this was a big help.