Skip to content

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

@IosDeveloperHarsh

Description

@IosDeveloperHarsh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions