# Reject outside chartArea

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)'
    }
  }
}
Last Updated: 2/15/2025, 9:30:36 PM