[Chartjs]-Angular-chartjs Data labels over bar chart

0👍

Try this options:

hover: {
    animationDuration: 0
},
animation: {
    onComplete: function () {
        var ctx = this.chart.ctx;
        var metaInfo = null;
        ctx.font = '12px "Helvetica Neue", Helvetica, Arial, sans-serif';
        ctx.fillStyle = 'gray';
        ctx.textAlign = "center";
        ctx.textBaseline = "bottom";

        _.forEach(this.config.data.datasets, function (dataset, i) {
            metaInfo = dataset._meta[Object.keys(dataset._meta)[i]];
            _.forEach(metaInfo.data, function (bar) {
                ctx.fillText(scope.data[bar._index], bar._model.x, bar._model.y);
            });
        })
    }
},
tooltips: {
    enabled: false
}

_ – lodash library (you can use forEach like your code above)

I am using version 1.1.1 of angular-chart.js

Leave a comment