问题
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!
回答1:
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;
回答2:
Use a Zedgraph method: // Restores the scale ranges to the values before all zoom and pan operations zg1.ZoomOutAll(GraphPane);
来源:https://stackoverflow.com/questions/5266275/zedgraph-zooming-and-resizing