oxyplot / oxyplot-xamarin

OxyPlot for Xamarin.Mac and Xamarin.Forms
MIT License
64 stars 59 forks source link

Zoom and Pan not working in the latest version (Oxyplot xamarin forms 2.1.0) #147

Open IosDeveloperHarsh opened 1 year ago

IosDeveloperHarsh commented 1 year ago

Facing issue with the latest code panning and zooming not working Here is configuration of the project .Net Standards - 2.0 Xamarin.forms. - 5.0.0.3578 Oxyplot.Xamarin.Forms - 2.1.0 Xamarin.Essentials - 1.7.7

`private PlotModel GetPlotModelInstance() { var model = new PlotModel { TitleFontWeight = 300, TitleColor = OxyColors.Gray, Background = OxyColors.White, };

        LinearAxis lineaXrAxis = new LinearAxis
        {
            Title = "XAxis",
            Unit = "Time",
            Position = AxisPosition.Bottom,
            AxislineColor = OxyColor.FromRgb(96, 96, 96),
            IsZoomEnabled = true,
            AxislineStyle = LineStyle.Solid,
            IsPanEnabled = true,
        };
        model.Axes.Add(lineaXrAxis);

        LinearAxis linearYAxis = new LinearAxis
        {
            Title = "YAxis",
            Position = AxisPosition.Left,
            AxislineColor = OxyColor.FromRgb(96, 96, 96),
            IsZoomEnabled = false,
            AxislineStyle = LineStyle.Solid,
            IsPanEnabled = false
        };
        model.Axes.Add(linearYAxis);

        var eulerSeries = new LineSeries
        {
            Title = "Euler, h=0.25",
            MarkerType = MarkerType.Circle,
            MarkerFill = OxyColors.Black,
        };

        eulerSeries.Points.AddRange(Euler((t, y) => Math.Cos(t), 1, 0, 14, 0.25));

        model.Series.Add(eulerSeries);

        return model;
    }

private static List Euler( Func<double, double, double> f, double t0, double y0, double t1, double h) { var points = new List(); double y = y0; for (double t = t0; t < t1 + h / 2; t += h) { points.Add(new DataPoint(t, y)); y += h * f(t, y); } return points; }`

Actual Output Graph is getting loaded but Zoom and Pan is not happening even if its set true

Excepted Output Graph Should zoom and Pan

Enigma86d commented 1 year ago

Same issue here, I'm using Xamarin forms and zoom and pan works on V1.0.0 but doesn't work on V2.0.0 nor V2.1.0.