Page 1 of 1

TChart.Page.Next Problem

Posted: Thu Dec 28, 2006 2:09 am
by 9638303
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

Posted: Thu Dec 28, 2006 8:58 am
by Pep
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.

Posted: Wed Jan 03, 2007 7:46 am
by 9638303
Dear Sir

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

Thank
Eirc

Posted: Wed Jan 03, 2007 9:43 am
by narcis
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.

Posted: Thu Jan 04, 2007 4:25 am
by 9638303
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

Posted: Thu Jan 04, 2007 8:10 am
by narcis
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.

Posted: Fri Jan 05, 2007 2:21 am
by 9638303
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

Posted: Fri Jan 05, 2007 11:35 am
by narcis
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

Posted: Mon Jan 08, 2007 3:04 am
by 9638303
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

Posted: Mon Jan 08, 2007 8:12 am
by narcis
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.

Posted: Tue Jan 09, 2007 3:20 am
by 9638303
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

Posted: Tue Jan 09, 2007 8:50 am
by narcis
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