|
Continuous time labels |
Posted by Stephan Bielmann on Jun-26-2014 22:38 |
|
Hello all,
I use CD with C++. I have a chart where I show what happens during a 200 hour
time frame. Is there a way with CD itself to label the axis the way that I get HH:MM
but not related to a date?
I would like to see 30:20, when I am at the data point that happened at 30 hours and
20 minutes, actually with setLabelFormat("{value|hh:nn}"), I get 06:20 instead.
Thanks for any help. |
Re: Continuous time labels |
Posted by Peter Kwan on Jun-26-2014 22:54 |
|
Hi Stephan,
It is easier if you can accept something like 6:20, 30:20 and 100:20 (note: it is 6:20
instead of 06.20 as mentioned in your post). Personally, I think using 6:20 instead of 06:20
is more consistent, as the number of hour digits are not fixed anyway (you need 3 digits
sometimes).
To achieve the above, you may use integers 0, 1, 2, ..... to represent the time elapsed in
seconds. For the label format, you may use:
{=({value}/3600-0.4999999)|0}:{value|nn}
The first part {=({value}/3600-0.4999999)|0} is the number of hours. The second part
{value|nn} is the number of minutes.
Hope this can help.
Regards
Peter Kwan |
Re: Continuous time labels |
Posted by Stephan Bielmann on Jun-27-2014 15:58 |
|
Hello Peter,
you are right, one digit for hours is fine. I was not aware that the parameter substitution is that powerfull. Thanks for the hint, this is exactly what I was looking for.
Kind regards, Stephan |
|