Teja Goud Kandula
Teja Goud Kandula

Reputation: 1574

Format percentage to the single digit after the decimal

There is a number like this:

77.18%

enter image description here

It should be displayed like this:

77.2%

I have formatting using: .4s , .3s, .1% and few other formats which didn't make any change to the format.

Right now the adaptive formatting in Apache superset is giving 2 digits after the decimal, what should be the number format in order to display percentage number with 1 digit after the decimal?

Upvotes: 0

Views: 613

Answers (1)

Cedric Casenove
Cedric Casenove

Reputation: 346

With d3.js, d3.format(".1%")(0.7718) will return 77.2%.

You have to give a decimal number in input to the formatter.

Upvotes: 1

Related Questions