Angular nvd3 Horizo​​ntalBarChart在barLine和holizontalLine中显示的格式不同

Angular nvd3 HorizontalBarChart displayed difference format in the barLine and the holizontalLine

我正在创建一个图表,它使用基于 nvd3 和 d3.js 的 Angular-nvd3 库,我遇到了一个问题 我想在图表 barLine 中显示百分比,在图表 horizo​​ntalLINe 中显示总数,如下所示:

但目前,我不知道该怎么做。 我创建了一个 plnkr:[http://plnkr.co/edit/PygsTn?p=preview][2]

希望能得到一些帮助。感谢您花时间看我的问题。

你可以用 valueFormat 属性:

chart: {
    valueFormat: function(value){
        return Math.floor(value/TOTAL * 100) + "%";
    }
}

修改后的插件:http://plnkr.co/edit/ilaNl5KEqZa02HbWby9s?p=preview