Problem with label on charts in ChartJS

1

I'm using ChartJs and StackedBar to create some charts, but ChartJs does not have the option to put their values on top of the bars, so I've implemented the following solution:

    onAnimationComplete: function() {
        var ctx = this.chart.ctx;
        ctx.font = this.scale.font;
        ctx.fillStyle = '#FFF';
        ctx.fontSize = '14px';
        ctx.textAlign = "center";
        ctx.textBaseline = "middle";
        this.datasets.forEach(function(dataset) {
            dataset.bars.forEach(function(bar) {
                ctx.fillText(bar.value, bar.x, bar.y + 15);
            });
        });
    }

However, when you hover over the graphics, the values are as shown in Fiddle below:

link

Can someone help me make the values do not add up when I move the mouse?

    
asked by anonymous 11.04.2016 / 22:07

0 answers