【问题标题】:rcharts nvd3 % format - precision to one tenth percentrcharts nvd3 % 格式 - 精确到十分之一
【发布时间】:2015-08-17 18:58:03
【问题描述】:

我正在使用 Rcharts nvd3 中的 lineChart,我想将 y 值格式化为精确到十分之一 % 的百分比。我可以将格式设置为如下所示的百分比,但是当我将鼠标悬停在点上时,它只显示精确到 1% 的百分比,我无法精确到小数点后十位。

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

我试过这样做,但没有成功:

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

【问题讨论】:

    标签: nvd3.js rcharts


    【解决方案1】:

    试试:

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

    来自d3 wiki

    精度表示类型为“f”和“%”的值应在小数点后显示多少位

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-05
      • 1970-01-01
      • 2014-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-24
      • 2023-03-18
      相关资源
      最近更新 更多