[Chartjs]-Chartjs bar-chart does not render when values are equal

2๐Ÿ‘

โœ…

15 is the smallest number in your dataset. Depending on how Chart.js determines the linear y-axis scale, it might start at 15. This means no bar is drawn as the value is equal to the lowest point of the y-axis, i.e.:

enter image description here

You can fix the issue by adding the beginAtZero property to your chart options:

options: {
    title: {
        display: true,
        text: 'Title Text'
    },
    scales: {
        yAxes: [{
            ticks: {
                beginAtZero: true
            }
        }]
    }
}

Result:

enter image description here

Leave a comment