Page 1 of 1

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

Posted: Wed Mar 06, 2013 5:04 pm
by 13052810
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!

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

Posted: Fri Mar 08, 2013 11:28 am
by yeray
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)

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

Posted: Fri Mar 08, 2013 1:36 pm
by 13052810
Thank you Yeray!

That fixed it!