Axis, calculate the increment property

TeeChart for ActiveX, COM and ASP
Post Reply
Kabal
Newbie
Newbie
Posts: 19
Joined: Mon Mar 13, 2006 12:00 am

Axis, calculate the increment property

Post by Kabal » Fri Mar 31, 2006 4:56 am

Hello,

I want to calculate increment in the following way:

Code: Select all

        With sourceChart.Axis
            Dim min, max As Double
            
            .Left.Visible = True
            .Left.Automatic = True

            min = .Left.Minimum
            max = .Left.Maximum
            .Left.Increment = (max - min) / 5
        End With
but TChart show labels as as if Increment property is equal zero.
But if to set the breakpoint on line 'min = .Left.Minimum' (in VBA editor) when the Increment property is calculating correctly.

What is it and what it would be necessary to make that the increment was calculated always ?

Best regards, Rustam.

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 Mar 31, 2006 8:44 am

Hi Rustam,

When are you running this code? The problem may be that the original axis scales are still not calculated because the chart is not drawn yet. You could do several events combinations to achieve that but using the code below, which uses InternalRepaint to force the chart being drawn, works fine here.

Code: Select all

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 100
    
    TChart1.Environment.InternalRepaint

    With TChart1.Axis
        Dim min, max As Double

        .Left.Visible = True
        .Left.Automatic = True

        min = .Left.Minimum
        max = .Left.Maximum
        .Left.Increment = (max - min) / 5
    End With
End Sub
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

Kabal
Newbie
Newbie
Posts: 19
Joined: Mon Mar 13, 2006 12:00 am

Post by Kabal » Fri Mar 31, 2006 10:21 am

Thanks. It has helped me.

Post Reply