[Chartjs]-Chart.js Bar graph will not start at zero as minimum value

12👍

Move the options part to the Chart creation:

var LineGraph = new Chart(ctx, {
    type: 'line',
    data: chartdata,
    options: {
        responsive: true,
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero: true
                }
            }]
        }
    }
});

Here’s an example from the docs.

2👍

options: {
     resposive: true,
     scales: {
             y: {
                suggestedMin: 0,
                suggestedMax: 100
                }
             }
     }

Leave a comment