[Chartjs]-Chart JS data labels getting cut

40👍

You need to set padding to display the labels properly. Also, adjust the canvas width and height to account for padding so that your chart doesn’t get too small.

options: {        
    layout: {
        padding: {
            left: 50,
            right: 50,
            top: 50,
            bottom: 50
        }
    }
}

6👍

Set max tick in chart option, for example:

this.chartOption.scales.yAxes[0].ticks.max = Math.max(...chartData3.datasets[0].data) * 1.2

Leave a comment