Zooming is performed by clicking and selecting an area over the chart with the mouse. Pan is activated by keeping ctrl pressed.
const zoomOptions ={pan:{enabled:true,mode:'xy',modifierKey:'ctrl',},zoom:{mode:'xy',// here is the magic!onZoomStart:({chart, point})=> chart.isPointInArea(point),drag:{enabled:true,borderColor:'rgb(54, 162, 235)',borderWidth:1,backgroundColor:'rgba(54, 162, 235, 0.3)'}}}
constNUMBER_CFG={count:20,min:-100,max:100}const data ={datasets:[{label:'My First dataset',borderColor: Utils.randomColor(0.4),backgroundColor: Utils.randomColor(0.1),pointBorderColor: Utils.randomColor(0.7),pointBackgroundColor: Utils.randomColor(0.5),pointBorderWidth:1,data: Utils.points(NUMBER_CFG),},{label:'My Second dataset',borderColor: Utils.randomColor(0.4),backgroundColor: Utils.randomColor(0.1),pointBorderColor: Utils.randomColor(0.7),pointBackgroundColor: Utils.randomColor(0.5),pointBorderWidth:1,data: Utils.points(NUMBER_CFG),}]}