var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3] }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] }, // Container for pan options pan: { // Boolean to enable panning enabled: true, // Panning directions. Remove the appropriate direction to disable // Eg. 'y' would only allow panning in the y direction mode: 'x', speed: 1 }, // Container for zoom options zoom: { // Boolean to enable zooming enabled: true, // Zooming directions. Remove the appropriate direction to disable // Eg. 'y' would only allow zooming in the y direction mode: 'x', } } }); $('#reset_zoom').click(function(){ myChart.resetZoom(); console.log(myChart); }); $('#disable_zoom').click(function(){ myChart.ctx.canvas.removeEventListener('wheel', myChart._wheelHandler); }); $('#enable_zoom').click(function(){ myChart.ctx.canvas.addEventListener('wheel', myChart._wheelHandler); });