Bottom Axis Maximum (time based) goes to zero after 23:59

TeeChart for ActiveX, COM and ASP
Post Reply
tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

Bottom Axis Maximum (time based) goes to zero after 23:59

Post by tirby » Wed Mar 06, 2013 5:04 pm

Hi,

I'm using:
VB6 - SP5
TeeChart Pro v7.0.1.4

Here's my setup:

Code: Select all

For aa = 0 To 7
    TChart1.Series(aa).XValues.DateTime = True
Next aa
With Tchart1.Axis
   .Bottom.Labels.DateTimeFormat = "h:mm"
   .Bottom.MinorTickCount = 4
   .Bottom.Labels.Style = talValue
   .Bottom.Maximum = TimeValue(Format$(TimeSerial(0, JobLength, 0), "hh:mm"))
   .Bottom.Increment = TChart1.GetDateTimeStep(dtOneSecond)
   .Bottom.Logarithmic = False
End With
Here's the problem:
If I set JobLength to 1439 (24 hrs * 60 Mins. minus 1 minute) the right side of the bottom axis shows 23:00 and has space for the final hour. If I set JobLength to 1440 or more, "0:00" jumps to the middle of the graph, and is the only time mark displayed.
I don't know how to handle going over the 24 hour mark.
I expect/need the time mark following 23:00 to be 0:00, and continue for as many as is neccessary/required.
In other words, the JobLength could easily exceed several days, requiring a recalculation of the bottom axis maximum.
Can you assist?

Thanks!

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Bottom Axis Maximum (time based) goes to zero after 23:59

Post by Yeray » Fri Mar 08, 2013 11:28 am

Hello,

Note, when you run this:

Code: Select all

MsgBox TimeValue(Format$(TimeSerial(0, 1439, 0), "hh:mm"))
You get this:

Code: Select all

23:59:00
And when you run this:

Code: Select all

MsgBox TimeValue(Format$(TimeSerial(0, 1440, 0), "hh:mm"))
You get this:

Code: Select all

0:00:00
Your Format call (with that "hh:mm" pattern) makes you loose the Date, that has incremented in a day between 1439 and 1440. So you are generating a wrong maximum for the axis.
Try simply this in your code:

Code: Select all

.Bottom.Maximum = TimeSerial(0, JobLength, 0)
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

Re: Bottom Axis Maximum (time based) goes to zero after 23:59

Post by tirby » Fri Mar 08, 2013 1:36 pm

Thank you Yeray!

That fixed it!

Post Reply