ZedGraph Zooming And Resizing

sooprise picture sooprise · Mar 10, 2011 · Viewed 8.6k times · Source

When I draw a graph, and zoom in and out of it, and redraw it, the location of the graph doesn't change.

What I want to be able to do is have the view change to see all of the graphed data whenever the data is redrawn. This seems to be disabled if you zoom in or out before redrawing.

Thanks!

Answer

JYelton picture JYelton · Aug 4, 2011

Set the property .IsZoomOnMouseCenter to true for the control:

zedGraphControl1.IsZoomOnMouseCenter = true;

Also you may want to change the settings for horizontal and/or vertical zoom, in case you want to allow the graph to only zoom (stretch) along one axis:

// Enable only horizontal zoom/stretch
zedGraphControl1.IsEnableHZoom = true;
zedGraphControl1.IsEnableVZoom = false;