Zoom Custom Axis
Posted: Thu May 12, 2011 3:41 pm
I have read the link refering to zooming custom axes, but i need some help converting the Delphi code to AxtiveX.
My chart has custom left and bottom axes, because I need the relationship to be a 1:1 ratio since I am plotting a gear tooth profile.
I have written the following code, but do not know how to capture the cursor locations for SetMinMax.
Private Sub AxTChart1_OnZoom(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxTChart1.OnZoom
AxTChart1.Axis.Left.SetMinMax()
AxTChart1.Axis.Bottom.SetMinMax()
End Sub
Instead of using the code above, I have modified the routine as follows.
Private Sub AxTChart1_OnZoom(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxTChart1.OnZoom
Dim top As Double
top = AxTChart1.Axis.Left.Minimum + (AxTChart1.Axis.Bottom.Maximum - AxTChart1.Axis.Bottom.Minimum)
AxTChart1.Axis.Left.SetMaximum(top)
End Sub
The proper values are captured for the size of the zoom window, but when I execute it, nothing happens. I tried adding a Refresh to the routine, but that had no affect.
Zooming is allowed on the chart editor.
Thanks,
Mike
My chart has custom left and bottom axes, because I need the relationship to be a 1:1 ratio since I am plotting a gear tooth profile.
I have written the following code, but do not know how to capture the cursor locations for SetMinMax.
Private Sub AxTChart1_OnZoom(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxTChart1.OnZoom
AxTChart1.Axis.Left.SetMinMax()
AxTChart1.Axis.Bottom.SetMinMax()
End Sub
Instead of using the code above, I have modified the routine as follows.
Private Sub AxTChart1_OnZoom(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxTChart1.OnZoom
Dim top As Double
top = AxTChart1.Axis.Left.Minimum + (AxTChart1.Axis.Bottom.Maximum - AxTChart1.Axis.Bottom.Minimum)
AxTChart1.Axis.Left.SetMaximum(top)
End Sub
The proper values are captured for the size of the zoom window, but when I execute it, nothing happens. I tried adding a Refresh to the routine, but that had no affect.
Zooming is allowed on the chart editor.
Thanks,
Mike