Hi,
I want to ask if it is possible to the Label with the percentage value. I have try without success. Thanks.
var data = {
labels:['mon','tue','wed'],
series: [5, 3, 4]
};
var sum = function(a, b) { return a + b };
new Chartist.Pie('.ct-chart', data, {
labelInterpolationFnc: function(value) {
return Math.round(value / data.series.reduce(sum) * 100) + '%';
}
});
If you want the value to be passed to labelInterpolationFnc you should not specify any labels.
Hi,
What I want to achieve is for the label on the pie chart for example to show "mon 42%" instead of the present code which only show the "42%". Thanks.
did you try this?
new Chartist.Pie('.ct-chart', data, {
labelInterpolationFnc: function(label, index) {
return label + " " + Math.round(data.series[index] / data.series.reduce(sum) * 100) + '%';
}
});
Closing this issue, please re-open if needed
Most helpful comment
did you try this?