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
Zoom Custom Axis
Re: Zoom Custom Axis
Hello MikeK,
Thanks,
To achieve cursor location you need use Mouse Events for example OnMouseClick or OnMouseDown or OnMouseMove etc.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
On the other hand, event OnZoom works fine for me. Please can you arrange a simple project because we can reproduce exactly your problem here?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.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |