Oxyplot XamarinAndroid "Zoom"-Question

Oystein Bjorke fa 5 anys 0
This discussion was imported from CodePlex

Death69 wrote at 2014-07-15 08:29:

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.)

Slxe wrote at 2014-07-15 15:31:

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).

Death69 wrote at 2014-07-16 08:07:

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?

Slxe wrote at 2014-07-16 16:57:

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.

Death69 wrote at 2014-07-16 17:02:

Ok with your version it works. The wrong part in my code was:
plotView.Model.InvalidatePlot(true);
Thank you for your help.
CodePlex