I would like to know how to programmatically do the "Set scale to default" feature accesible via a right clic on a graph ?
I can't manage to reproduce the correct behavior by using YAxis.Scale.Min YAxis.Scale.Max
.
Asked
Active
Viewed 1,379 times
1

Guillaume Paris
- 10,303
- 14
- 70
- 145
-
1possible duplicate of [Zed-Graph Set scale to default programmatically](http://stackoverflow.com/questions/7834604/zed-graph-set-scale-to-default-programmatically) – Bas Jan 08 '14 at 15:12
2 Answers
2
I used the following code (replace GetActiveZgc() with your ZedGraphControl object).
void ZoomReset()
{
GetActiveZgc().IsEnableHPan = false;
GetActiveZgc().IsEnableHZoom = false;
for (int i = GetActiveZgc().GraphPane.ZoomStack.Count * 2; i >= 0; i--)
{
GetActiveZgc().ZoomOut(GetActiveZgc().GraphPane);
}
GetActiveZgc().GraphPane.XAxis.Scale.Min = 0;
GetActiveZgc().GraphPane.YAxis.Scale.Min = 0;
GetActiveZgc().IsEnableHPan = true;
GetActiveZgc().IsEnableHZoom = true;
}

Oleg Cheremisin
- 66
- 3
2
It seems that contex menu item "Set scale to default" calls this:
ZedGraphControl.RestoreScale(ZedGraphControl.GraphPane);

AlexThunder
- 168
- 11