Chartjs-In line chart, line is going beyond height when I remove y axis

0👍

Without seeing the chart’s configuration, I would suggest to hide only the y-axis tick labels instead of the entire y-axis:

options: {
    scales: {
        yAxes: [{
            ticks: {
                display: false
            }
        }]
    }
}

Another solution could be to add a suggestedMax property to the y-axis. Use Math.max() or any other function to get the maximum y value you’re going to receive and then pass this value to suggestedMax:

options: {
    scales: {
        yAxes: {
            suggestedMax: 5
        }
    }
}

Anyway if you could post your chart’s configuration it would be helpful.

Leave a comment