0

I see there are several older posts referencing axis.IsZoomEnabled = false as the way to disable zooming with Ozyplot, but that doesn't seem to work.

I have also tried creating a PlotController and unbinding the mouse wheel, but this is also not working. CustomControl.UnbindMouseWheel(); and Controller="{Binding CustomControl}" in xaml.

How can I disable the mouse wheel and zoom feature on Oxyplot?

4
  • You can still zoom by rotating the mouse wheel? I'm asking because if you just unbind the mouse wheel, you can press the mouse wheel down and zoom by selection (which is a little confusing, if you ask me). I assume you want that disabled, also? Can you post your XAML? Commented Dec 28, 2021 at 16:36
  • @JimFoye, yes the mouse still has ALL functionality. I just want the entire mouse disabled. I am going to use a scrollbar to pan left and right. Here is my xaml; (I left the header stuff out) <Grid> <oxy:PlotView Controller="{Binding customController}" x:Name="plot" Model="{Binding PlotModel}" /> </Grid> Commented Dec 28, 2021 at 16:42
  • 1
    I suggest you do what I do: call controller.UnbindAll(), then, if needed, restore binding on something that you want. I call controller.BindMouseDown (OxyMouseButton.Left, PlotCommands.Track) because I want to enable tracking. I really think these bindings should be opt-in and not opt-out. Commented Dec 28, 2021 at 17:32
  • If I am not wrong you must set IsZoomEnabled = false on both axes (X and Y). Commented May 28, 2024 at 8:17

1 Answer 1

2

I was struggling with this as well when doing a HeatMap in Oxyplot. Using the examples, the comments indicated that the X and Y Axis are generated automatically. So naturally, I tried to set the HeatMapPlotModel.DefaultXAxis.IsPanEnabled to false, but it didn't seem to do anything.

But when I added my own axes (instead of using the automatic ones), the pan and zoom were successfully disabled using those properties (IsPanEnabled & IsZoomEnabled = false).

Working:

HeatMapPlotModel.Axes.Add(new LinearAxis() { IsPanEnabled = false, IsZoomEnabled = false });  
HeatMapPlotModel.Axes.Add(new LinearAxis() { IsPanEnabled = false, IsZoomEnabled = false, Position = AxisPosition.Bottom });

Did not work:

HeatMapPlotModel.DefaultXAxis.IsPanEnabled = false;
HeatMapPlotModel.DefaultYAxis.IsPanEnabled = false;
HeatMapPlotModel.DefaultXAxis.IsZoomEnabled = false;
HeatMapPlotModel.DefaultYAxis.IsZoomEnabled = false;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.