|
axis label format |
Posted by Gerrit on Oct-26-2011 00:35 |
|
Hi Peter,
I try to format y axis labels. The data is in seconds. I need the following formats:
? seconds
? minutes:seconds
? hours:minutes:seconds
? minutes
? hours:minutes
? hours
The first format is no problem because the data are seconds. For the minutes:seconds format I tried chartYAxis.setLabelFormat("{value|nn:ss}"); My problem is that the minutes are only two-digit. For instance I have 74070 seconds and the format is minutes:seconds I expect 1234:30. With the format "{value|nn:ss}" I get 34:30 and with "{value|nnnn:ss}" I get 3434:30.
For the minutes format I try chartYAxis.setLabelFormat("{={value}/60}");. In this case I need a number without post decimal positions, so this solution does not work for me.
I hope you have any suggestions for me.
Regards
Gerrit |
Re: axis label format |
Posted by Peter Kwan on Oct-26-2011 02:25 |
|
Hi Gerrit,
For "elapsed minutes", it is:
{=({value}-{value}%60) / 60}
Basically, the above is the same as {value}/60, except that we subtract the remainder {value}%60 out first, so the division result must be an integer.
For "elapsed minutes":seconds, it is:
{=({value}-{value}%60) / 60}:{value|ss}
The above is just the elapsed minutes, followed by "ss", which is the "seconds of minute" (a second value from 00 to 59).
Similarly, for "elapsed hours", it is:
{=({value}-{value}%3600) / 3600}
and you can similarly composed "elapsed hours":minutes:seconds and "elapsed hours":minutes, etc..
Hope this can help.
Regards
Peter Kwan |
|