[Chartjs]-Issue with int numbers using chart.js

1👍

Apparently there is not option for changing this out of the box. You’ll have to change the source.

Simply change:

function drawDoughnutText(animationDecimal, segmentTotal) {
   $summaryNumber
      .css({opacity: animationDecimal})
      .text((segmentTotal * animationDecimal).toFixed(1));
}

to

function drawDoughnutText(animationDecimal, segmentTotal) {
   $summaryNumber
      .css({opacity: animationDecimal})
      .text((segmentTotal * animationDecimal).toFixed(0));
}

Bear in mind the total will be always an integer, even though it sums up to a float number.

3👍

On line 216 of the jsfiddle change the toFixed parameter to 0

.text((segmentTotal * animationDecimal).toFixed(0));

Leave a comment