Skip to content

Pan and Zoom not working #62

Open
Open
@Nuada26

Description

@Nuada26

Hi all,

I have a problem with my plotview in Xamarin forms, i see it but when i try to pan or zomm on it, it's not work.

This is my code in C#:

        var model = new PlotModel { Title = "Hello, Forms!", PlotAreaBorderColor = OxyColors.Transparent };

        var BottomAxis = new TimeSpanAxis();
        BottomAxis.Position = AxisPosition.Bottom;
        model.PlotAreaBorderThickness = new OxyThickness(0, 0, 0, 0);
        BottomAxis.IntervalLength = TimeSpanAxis.ToDouble(new TimeSpan(1,0,0));

        var LeftAxis = new LinearAxis();
        LeftAxis.Position = AxisPosition.Left;
        LeftAxis.Minimum = 0d;
        LeftAxis.Maximum = 50d;
        var myController = new PlotController();
        plotview.Controller = myController;
        
        model.Axes.Add(LeftAxis);
        model.Axes.Add(BottomAxis);

        var Serie = new LineSeries();
        Serie.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(DateTime.Now.TimeOfDay.Subtract(new TimeSpan(0, 0, 20))),10d ));
        Serie.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(DateTime.Now.TimeOfDay.Subtract(new TimeSpan(0, 3, 20))),55d ));
        Serie.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(DateTime.Now.TimeOfDay.Subtract(new TimeSpan(0, 4, 20))),15d ));

        model.Series.Add(Serie);
        plotview.Model = model;

And this is View on XAML:

<oxy:PlotView x:Name="plotview" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3"/>

Any idea for resolve that?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions