nikunj
Posts: 22
Joined: Tue Nov 20, 2018 7:06 am

Display two digits in Milliseconds.

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
WhoAmI
Posts: 33
Joined: Tue Dec 01, 2015 1:22 pm

Re: Display two digits in Milliseconds.

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%`

nikunj
Posts: 22
Joined: Tue Nov 20, 2018 7:06 am

Re: Display two digits in Milliseconds.

Hello

Already applied valueDecimals but didn't worked.
bastss
Site Admin
Posts: 1206
Joined: Wed Oct 17, 2018 10:59 am

Re: Display two digits in Milliseconds.

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!
Sebastian Wędzel,
Highcharts Developer
nikunj
Posts: 22
Joined: Tue Nov 20, 2018 7:06 am

Re: Display two digits in Milliseconds.

Hello

It's Working

Thank you

Return to “Highcharts Usage”