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?

  • 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? – Jim Foye Dec 28 '21 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) ``` ``` – Will Roberts Dec 28 '21 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. – Jim Foye Dec 28 '21 at 17:32

1 Answers1

1

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;
Teddy Tea
  • 31
  • 5