chartjs/Chart.BarFunnel.js

Jumping percentages above bars

wrostek opened this issue · 0 comments

Just wanted to add that, if your chart has:

legend: {
display: false
}

It will cause the percentages above bars to jump (once the animation is complete and the user mouses over the bars)

I have found the solution is to modify chart.barFunnel.js and add at line 167:
ctx.textBaseline = 'top';

so it becomes:

if (dataset.data[index] > 0) {
// Draw Step Label
ctx.textBaseline = 'top';
tx.font = vm.stepLabelFontSize + "px " + options.defaultFontFamily;
ctx.fillStyle = vm.stepLabelColor;
ctx.textAlign = "center";
ctx.fillText(label.toFixed(0) + "%", vm.x, vm.y - vm.stepLabelFontSize);
}

This may be good to get into the next release!