Page 1 of 1

Display two digits in Milliseconds.

Posted: Thu Nov 22, 2018 10:54 am
by nikunj
Hello

We used datetime type y-Axis Labels.
For tooltip we use
tooltip.setPointFormat("{point.y:%H:%M:%S.%L}");

%L display milliseconds in 3 digit. But we want it in only 2 digit.

Please suggest way to display like that.

Thank You
Nikunj

Re: Display two digits in Milliseconds.

Posted: Thu Nov 22, 2018 10:55 am
by WhoAmI
Dear Nikunj,

Kindly use

Code: Select all

  tooltip: {
        valueDecimals: 2
    },
Just for the info

Code: Select all


// point.percentage = 29.9345816
pointFormat: '{point.percentage:.0f}%' // returns: `30%` - (rounds to nearest)
pointFormat: '{point.percentage:.1f}%' // returns: `29.9%`
pointFormat: '{point.percentage:.2f}%' // returns: `29.93%`
pointFormat: '{point.percentage:.3f}%' // returns: `29.935%`


Re: Display two digits in Milliseconds.

Posted: Thu Nov 22, 2018 11:02 am
by nikunj
Hello

Already applied valueDecimals but didn't worked.

Re: Display two digits in Milliseconds.

Posted: Thu Nov 22, 2018 1:48 pm
by bastss
Hey nikunj,

Formatting tooltip to display whatever we want is possible by using tooltip.formatter function - API: https://api.highcharts.com/highcharts/tooltip.formatter. But displaying two digits in milliseconds doesn't make any sense, because one second is equal 1000 milliseconds. That's like displaying only one digit in hours or minutes...

Demo: https://jsfiddle.net/Bastss/7carz8L9/

Kind regards!

Re: Display two digits in Milliseconds.

Posted: Fri Nov 23, 2018 9:43 am
by nikunj
Hello

It's Working

Thank you