Chartjs-Chart.js with 2 y-axis

2πŸ‘

βœ…

I got it working by updating the right yAxis min and max values. Right now it only gets updated at the beginning, so it’s not responsive. You have to call updateOptions() everytime you change your chart (e.g. when you hide datasets)…

Here is my code (JSBin)

function updateOptions() {
  chart.options.scales.yAxes[1].ticks = {
    min: chart.scales.A.ticksAsNumbers[chart.scales.A.ticksAsNumbers.length-1],
    max: chart.scales.A.ticksAsNumbers[0]
  }
  chart.update()
}

Leave a comment