Zoom Custom Axis

TeeChart for ActiveX, COM and ASP
Post Reply
MikeK
Newbie
Newbie
Posts: 1
Joined: Tue Feb 01, 2011 12:00 am

Zoom Custom Axis

Post by MikeK » 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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Zoom Custom Axis

Post by Sandra » Fri May 13, 2011 3:23 pm

Hello MikeK,
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
To achieve cursor location you need use Mouse Events for example OnMouseClick or OnMouseDown or OnMouseMove etc.
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.
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?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply