Chartjs-Chart.js not showing all labels on pie chart

0👍

chart.legend.afterFit = function () {
    if (keys.length > 4) {
        this.options.labels.padding = 15;
        this.height = this.height + 25;
    }
    else {
        this.options.labels.padding = 20;
        this.height = this.height + 18;
    }
    var width = this.width; // guess you can play with this value to achieve needed layout
    this.lineWidths = this.lineWidths.map(function () { return width; });
};

I changed the part at afterFit to this, so it is formatting right, the problem is, the padding settings are set back when i click on a label.

Leave a comment