2

I'm using lineChart from Rcharts nvd3, and I'd like to format the y values as a percent precise to one tenth of a %. I can format as a percent as below, but when I hover over the points, it only shows a % precise to 1%, I can't get it to be precise to the tenth decimal place.

p$yAxis(tickFormat = "#!
        function(d) {return d3.format('%')(d)}
        !#"
)

I tried doing this, but didn't work:

p$yAxis(tickFormat = "#!
            function(d) {return d3.format('.0%')(d)}
            !#"
    )
md1630
  • 841
  • 1
  • 10
  • 28

1 Answers1

1

Try:

p$yAxis(tickFormat = "#!
        function(d) {return d3.format('.1%')(d)}
        !#"
)

From the d3 wiki:

The precision indicates how many digits should be displayed after the decimal point for a value formatted with types "f" and "%"

cheniel
  • 3,473
  • 1
  • 14
  • 15