Oxyplot XamarinAndroid "Zoom"-Question

Jul 15, 2014 at 7:29 AM
Hi,
I wanted to know if it is possible to make a "Center-Button" for a PlotView with your library. I created an plotview in my application that is zoomable with touch gesture. And I need a method to reset the Zoom. But I couldn't find a property or method for this. Is this implemented or do i need to figure out a way to do is?

Btw: Thanks for this great library :D

Greetings

(If anything is unclear, just ask.)
Jul 15, 2014 at 2:31 PM
You could hook up your own input to call PlotModel.ResetAllAxes(), the PlotController already defines 'a' and double mouse button 3 to do this if you want an example (it's in PlotCommands).
Jul 16, 2014 at 7:07 AM
Edited Jul 16, 2014 at 7:16 AM
Ok so if i do something like this:
centerButton.Click += (object sender, EventArgs e) =>
            {
                centerButton_Click(sender, e, view, plotView);
            };
and handle it with this:
private void centerButton_Click(object sender, EventArgs e, View view, PlotView plotView)
        {
            plotView.Model.ResetAllAxes();
            plotView.Model.InvalidatePlot(true);
        }
then nothing happens. Is that what you suggested?
Jul 16, 2014 at 3:57 PM
Hmm, well you can simplify it assuming it's in the same class as you're setting up the plot view:
centerButton.Click += (s, args) =>
{
    plotView.Model.ResetAllAxes();
    plotView.InvalidatePlot(false);
}
As a side note, the boolean on InvalidatePlot tells the axes whether or not to recalculate based on the data in series linked to them. Also, this just resets all axes zoom levels so that it displays everything in the plot, it'll do nothing if you're not zoomed in some form or haven't panned.

Other than that I'm not really sure. I haven't had a chance to play with Xamarin or Mono at all (and the only android dev I've done was in Java), so not sure if it might be an issue with that =. I'm sure Objo will be around at some point and will have some better input on it.
Marked as answer by Death69 on 7/16/2014 at 10:48 PM
Jul 16, 2014 at 4:02 PM
Ok with your version it works. The wrong part in my code was:
plotView.Model.InvalidatePlot(true);
Thank you for your help.