[Chartjs]-Chartjs: update the min and maximum of the yaxes ticks on a click

1👍

You can use jQuery:

  • Add the jQuery library
  • Add a button, I added <button id="action">action</button>
  • Add a jQuery trigger that executes the 2 lines on click:

$('#action').off().on('click', function() {
myLineChart.options.scales.yAxes[0].ticks.min = -50;
myLineChart.update();
})

See: https://jsfiddle.net/gdqkLtc2/3/

Leave a comment