[Chartjs]-Want to show small part of js Bar Chart when value is zero

1👍

It looks like you can update the axes of your charts to a new default. So, using a modified form of their example, something like the following (modified to fit your code):

// ...
scales: {
    yAxes: [{
        display: false,
        gridLines: {
            display: false
        },
        ticks: {
            max: Math.max(...data.datasets[0].data) + 20,
            min: -3, // ADDED
            display: false,
            beginAtZero: true
        }
    }],
// ...

… would do what you’re looking for – with the side benefit that 0 and 3 wouldn’t look like the same value, the relative bar size should stay accurate.

Leave a comment