Keeping of aspect ratio while zooming

TeeChart for ActiveX, COM and ASP
Post Reply
ModelTech
Newbie
Newbie
Posts: 28
Joined: Tue Oct 09, 2007 12:00 am

Keeping of aspect ratio while zooming

Post by ModelTech » Fri Jan 11, 2008 11:32 am

Hi,

I want to keep aspect ratio while zooming. How can I do this using VBScript?

Thanks in advance,
Danila.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jan 11, 2008 11:37 am

Hi Danila,

You could try doing something as in the Isometric Axis example at All Features\Welcome!\Axes in the features demo available at TeeChart's program group.
Best Regards,
Narcís Calvet / 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

ModelTech
Newbie
Newbie
Posts: 28
Joined: Tue Oct 09, 2007 12:00 am

Post by ModelTech » Fri Jan 11, 2008 12:46 pm

Hi Narcís,

thank you for the fast reply. I have tested this example, but it does not work like zoom tool.

I want just "freeze one degree of freedom" of zoom tool (to make proportional X and Y). Is it possible with standart mechanisms of teechart?

Thanks in advance,
Danila.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jan 11, 2008 2:07 pm

Hello Danila,

Sorry but I don't what are you trying to achieve exactly. Could you please give us some more details?

Thanks in advance.
Best Regards,
Narcís Calvet / 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

ModelTech
Newbie
Newbie
Posts: 28
Joined: Tue Oct 09, 2007 12:00 am

Post by ModelTech » Fri Jan 11, 2008 2:15 pm


Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jan 11, 2008 2:33 pm

Hi Danila,

In that case you can do something like this:

Code: Select all

Option Explicit

Dim XRatio As Double

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 10
    
    TChart1.Environment.InternalRepaint
    
    XRatio = GetXRatio()
End Sub

Private Function GetXRatio() As Double
    GetXRatio = ((TChart1.Axis.Bottom.Maximum - TChart1.Axis.Bottom.Minimum) _
                / (TChart1.Axis.Left.Maximum - TChart1.Axis.Left.Minimum))
End Function


Private Sub TChart1_OnZoom()
    Dim CurrentXRatio As Double
    
    CurrentXRatio = GetXRatio()
    
    If (CurrentXRatio <> XRatio) Then
        TChart1.Axis.Left.Maximum = (TChart1.Axis.Bottom.Maximum - TChart1.Axis.Bottom.Minimum + _
                                    (TChart1.Axis.Left.Minimum * XRatio)) / XRatio
    End If
End Sub
Hope this helps!
Best Regards,
Narcís Calvet / 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