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

Display two digits in Milliseconds.

Thu Nov 22, 2018 10:54 am

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

Re: Display two digits in Milliseconds.

Thu Nov 22, 2018 10:55 am

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: 12
Joined: Tue Nov 20, 2018 7:06 am

Re: Display two digits in Milliseconds.

Thu Nov 22, 2018 11:02 am

Hello

Already applied valueDecimals but didn't worked.

bastss
Posts: 132
Joined: Wed Oct 17, 2018 10:59 am

Re: Display two digits in Milliseconds.

Thu Nov 22, 2018 1:48 pm

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!

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

Re: Display two digits in Milliseconds.

Fri Nov 23, 2018 9:43 am

Hello

It's Working

Thank you

Return to “Highcharts Usage”