[Chartjs]-Chart JS Zoom Pan

1👍

Yes, you can change this by setting “enabled” to false and/or use chart.resetZoom() link

0👍

Try this:

// since myChart.update() is not working. You need to do this.

var myChartOptions = myChart.options; // need to store in variable.

// check data present
if (data.length > 0) {
    myChartOptions.pan.enabled = true;
    myChartOptions.zoom.enabled = true;
    myChart.options = myChartOptions; // update myChart.options.
}
else {
    myChartOptions.pan.enabled = false;
    myChartOptions.zoom.enabled = false;
    myChart.options = myChartOptions; // update myChart.options.
}

Leave a comment