Chartjs-Chart js 3.9.1 – barchart – margin left

0πŸ‘

The issue sounds being related to categoryPercentage and barPercentage options that you are set in the axis but this is not the right place.

Move those options in the chart.options and it should work.

Try using categoryPercentage: 1.

var options = {
    categoryPercentage: 1,
    plugins:
    {
        datalabels:
        {
            color: 'white'
        },
        legend: {
            position: 'top', labels:
            {
                font: {size: 10},
                usePointStyle: true
            }
        }
        tooltip: {
            enabled: false
       },
    },
    scales:
    {
        y: {
            beginAtZero: true,
            grace: '3%',
        }
    }
};

Leave a comment