0

I am using react-chartjs-2 version 2.7.6. In line chart, if I keep y axis graph line is in limit. enter image description here

I want to remove y axis but when I remove y axis graph line goes above starting point. enter image description here

1 Answers1

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.

Denismr7
  • 559
  • 5
  • 3