Search code examples
c#.net-3.5zedgraph

Zedgraph - Set Min/Max values on an axis permanently


I am working on a zedgraph where the Y-axis is a percentage value. I want the min and max values to be 0/100 respectively. I can set this via the GraphPane.YAxis.Scale.Min and Max properties, and this works fine.

However, if the user does the rectangle drag to change the "viewport" of the graph, or zooms in/out, the Y-axis min/max changes. Is there a way I can force the Min/Max values to persist, but still allow the user to zoom / draw the selection box (essentially, allowing them to JUST pan/zoom the x-axis).

I've tried setting MinAuto / MaxAuto, but this seems to have no effect.


Solution

  • I had the same problem and solved it like this:

    zedGraphControl1.IsEnableVZoom = false;
    zedGraphControl1.IsEnableVPan = false;

    This should only allow Horizontal Zoom.