2👍
I’ve spent a little time on this and solved the issue.
What I gathered from studying the extension…
I moved the onAnimationComplete function into .extend:
Chart.types.Bar.extend({
name: "BarAlt",
draw: function () {
Chart.types.Bar.prototype.draw.apply(this, arguments);
var ctx = this.chart.ctx;
ctx.font = this.scale.font;
ctx.fillStyle = this.scale.textColor
ctx.textAlign = "center";
ctx.textBaseline = "bottom";
this.datasets.forEach(function (dataset) {
dataset.bars.forEach(function (bar) {
ctx.fillText(bar.value, bar.x, bar.y - 5);
});
})
}
});
- [Chartjs]-Plugins.legend.align are incompatible types typescript chartjs
- [Chartjs]-ChartJS: Translate x axis month to other languages
1👍
You’ll probably have to create a simple extension, since this seems to be a known issue in Chart.js: see this answer.
Source:stackexchange.com