After zoom, how to get max/min values of the axis ?
Posted: Mon Feb 28, 2011 9:22 pm
I have a graph and I would like to know the values of the MaxXValue, MinXValue, MaxYValue and MinYValue after the zoom. I have noticed that after the zoom these properties still have the previous values of the original graph prior the applied zoom.
The main problem is that I set :
TChart1.Axis.Bottom.Automatic = False
TChart1.Axis.Left.Automatic = False
and I perform the calculations for the max/min and the increment for the axis. Example: the increment is calculated to have the Y axis divided in 4 equal parts, which I have done with:
increment=(TChart1.Axis.Left.Maximum-TChart1.Axis.Left.Minimum)/2
TChart1.Axis.Left.Maximum=TChart1.Axis.Left.Maximum+increment
TChart1.Axis.Left.Minimum=TChart1.Axis.Left.Minimum-increment
TChart1.Axis.Left.Increment=increment
If I zoom the graph, by using the mouse to draw a rectangle, I would like to run the code above in order again in order to have the graph divided in 4 equal parts. Here the problem is that all events is fired before the method responsible to redraw the chart, and the Maximum e Minimum properties are not updated yet. If I use afterdraw event I always get in trouble with recursive call.
The main problem is that I set :
TChart1.Axis.Bottom.Automatic = False
TChart1.Axis.Left.Automatic = False
and I perform the calculations for the max/min and the increment for the axis. Example: the increment is calculated to have the Y axis divided in 4 equal parts, which I have done with:
increment=(TChart1.Axis.Left.Maximum-TChart1.Axis.Left.Minimum)/2
TChart1.Axis.Left.Maximum=TChart1.Axis.Left.Maximum+increment
TChart1.Axis.Left.Minimum=TChart1.Axis.Left.Minimum-increment
TChart1.Axis.Left.Increment=increment
If I zoom the graph, by using the mouse to draw a rectangle, I would like to run the code above in order again in order to have the graph divided in 4 equal parts. Here the problem is that all events is fired before the method responsible to redraw the chart, and the Maximum e Minimum properties are not updated yet. If I use afterdraw event I always get in trouble with recursive call.