Chartjs-ChartJS hide y-axis when dataset is hidden via legend

0๐Ÿ‘

I think you are changing the scales objects but you should change the chart configuration, because you are going to invoke the update of the chart.

See doc: https://www.chartjs.org/docs/latest/developers/updates.html#updating-options

chart.options.scales.y1.display = false;
chart.options.scales.y2.display = false;
chart.update();

Leave a comment