TChart.Page.Next Problem

TeeChart for ActiveX, COM and ASP
Post Reply
Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

TChart.Page.Next Problem

Post by Eric » Thu Dec 28, 2006 2:09 am

Dear Sir

TChart.Page.Next not working when TChart contain single series and MaxPointsPerPage = 1.

My TChart version is TeeChart Pro AX v6.0.1.1

Thank
Eric

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Dec 28, 2006 8:58 am

Hi Eric,

yes, you're correct, this bug has been fixed in the TeeChart Pro v7. As a workaround for the v6 would be to set the axis scales manually according the point that must be displayed.

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Wed Jan 03, 2007 7:46 am

Dear Sir

Can you please show me how to set the axis scales manually?

Thank
Eirc

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

Post by Narcís » Wed Jan 03, 2007 9:43 am

Dear Eric,

Please read Tutorial 4 - Axis Control for information on how to do that. You'll find the tutorials 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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Thu Jan 04, 2007 4:25 am

Dear Sir

Sorry! What I need is workaround vb6 sample code.
anyway after read the Tutorial 4 I also don't know how to do.

Eric

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

Post by Narcís » Thu Jan 04, 2007 8:10 am

Dear Eric,

You should use SetMinMax method, for example:

Code: Select all

TChart1.Axis.Bottom.SetMinMax 0, 10
Or do what's told in the Setting axis scales by code in the tutorial.
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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Fri Jan 05, 2007 2:21 am

Dear Sir
Below the code also cannot draw the chart nicely.
Can you please give me a correct workaround vb6 code?
This is third time i asking. :(

TChart1.Axis.Bottom.SetMinMax 0, 10

AND

Setting axis scales by code
You can change the Maximum and Minimum at runtime using this code:

With TChart1.Axis.Bottom
.Automatic = False
.Maximum = 36
.Minimum = 5
End With

You may set Axis scale Maximum and Minimum to automatic individually. e.g:

With TChart1.Axis.Bottom
.AutomaticMaximum = True
.AutomaticMinimum = False
.Minimum = 5
End With

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 05, 2007 11:35 am

Hi Eric,
Below the code also cannot draw the chart nicely.
Which is the exact problem you are having using this?
Can you please give me a correct workaround vb6 code?
Try doing something like this:

Code: Select all

Dim Page As Integer

Private Sub Command1_Click()
    With TChart1
        .Axis.Bottom.SetMinMax .Series(0).XValues.Value(0), .Series(0).XValues.Value(.Page.MaxPointsPerPage - 1)
        Page = 1
    End With
End Sub

Private Sub Command2_Click()
    With TChart1
        If Page > 1 Then
            Page = Page - 1
            .Axis.Bottom.SetMinMax .Series(0).XValues.Value(.Page.MaxPointsPerPage * (Page - 1)), .Series(0).XValues.Value((.Page.MaxPointsPerPage * (Page - 1)) + .Page.MaxPointsPerPage - 1)
        End If
    End With

End Sub

Private Sub Command3_Click()
    With TChart1
        If Page < .Page.Count Then
            .Axis.Bottom.SetMinMax .Series(0).XValues.Value(.Page.MaxPointsPerPage * Page), .Series(0).XValues.Value((.Page.MaxPointsPerPage * Page) + .Page.MaxPointsPerPage - 1)
            Page = Page + 1
        End If
    End With

End Sub

Private Sub Command4_Click()
    With TChart1
        .Axis.Bottom.SetMinMax .Series(0).XValues.Value(.Series(0).Count - .Page.MaxPointsPerPage), .Series(0).XValues.Value(.Series(0).Count - 1)
        Page = .Page.Count
    End With
End Sub

Private Sub Form_Load()
    With TChart1
        .AddSeries scBar
        
        .Page.MaxPointsPerPage = 5
        Page = 1
        
        .Series(0).FillSampleValues 20
        
    End With
    
End Sub

Private Sub TChart1_OnAfterDraw()
        TChart1.Axis.Bottom.MinimumOffset = 50
        TChart1.Axis.Bottom.MaximumOffset = 50
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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Mon Jan 08, 2007 3:04 am

Dear Sir
I think we have some miss understanding. Try to run below the code and click next and back buttom. The Tchart not draw the series but legend will do. I just want some workaround vb6 code to solved this problem.

Private Sub Next_Click()
TChart1.Page.Next
End Sub

Private Sub Back_Click()
TChart1.Page.Previous
End Sub
Private Sub Form_Load()
With TChart1
.AddSeries scBar
.Page.MaxPointsPerPage = 1
Page = 1
.Series(0).FillSampleValues 20
End With
End Sub

Eric

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

Post by Narcís » Mon Jan 08, 2007 8:12 am

Dear Eric,

Sorry if I my explanation was not complete. As my colleague Pep told you, in v6 those functions are not working fine. As he suggested a workaround is manually setting axes scales as I did in my example. What I forgot to tell you is why each button is used for. Command1 moves to the first page, Command2 moves the chart to the previous page, Command3 moves the chart to the next page and Command4 moves the chart to the last page. Could you please try this and let us know if it's what are you looking for?

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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Tue Jan 09, 2007 3:20 am

Dear Sir

Your code is working, but series doesn't draw correct position.
Just change below the code
TChart1 .Page.MaxPointsPerPage = 5
To
TChart1 .Page.MaxPointsPerPage = 1

and click Command2 and Command3

Thank
Eric

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

Post by Narcís » Tue Jan 09, 2007 8:50 am

Hi Eric,

Try playing a little fit with bottom axis offsets in the OnAfterDraw event. It works fine for me here using this:

Code: Select all

Private Sub TChart1_OnAfterDraw()
        TChart1.Axis.Bottom.MinimumOffset = 200
        TChart1.Axis.Bottom.MaximumOffset = 200
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

Post Reply