0
votes

nvd3-angular-directives pie chart is rounding of values when showing percentages. Is there a way to display the exact with decimal places? I have values 99.71% & 0.29% which are rounded to 100% and 0%.

...
<nvd3-pie-chart
        data="scenarioPie"
        id="scenarioPie"
        width="450"
        height="450"
        x="xFunction()"
        y="yFunction()"
        donut="true"
        tooltips="true"
        showLabels="true"
        donutLabelsOutside="true"
        labelType="percent"
        showLegend="true"
        donutRatio=".4">
<svg></svg>
...

I tried using a function as below to return a format but its not working

...
labelType="myFunction()"
...

$scope.myFunction=function() {
  return function(d){
    return d3.format(',.2%');
  }
}
1

1 Answers

-1
votes
$scope.xFunction = function(){ return function(d){ return d3.format('.02f')(d.x); }; };