Panning and Zooming

The Chart enables the user to view specific ranges by applying panning and zooming to the component.

To perform panning, drag the plot area of the Chart.

To perform zooming, either:

  • Mouse-wheel (desktop) or pinch-zoom (mobile), or
  • Hold the Shift key and select an area.

To enable the pan-and-zoom functionality, use the pannable and zoomable options.

Example
View Source
Edit In Stackblitz  
Change Theme:

Disabling Pan-and-Zoom Directions

You can prevent panning and zooming for an axis by using the lock configuration. To disable panning and zooming in the vertical direction, set the pannable.lock, zoomable.mouoswheel.lock, and zoomable.selection.lock options to 'y'. To disable panning and zooming in the horizontal direction, set the the pannable.lock, zoomable.mouoswheel.lock, and zoomable.selection.lock options to 'x'.

Example
View Source
Edit In Stackblitz  
Change Theme:

Pan-and-Zoom Events

When the user pans or zooms the Chart, the component triggers the following events, which contain the modified axes ranges.

  • dragStartFires when the Chart starts panning. If you prevent the event, the Chart will stop panning.
  • dragFires while the Chart is panning. If you prevent the event, the change in the current axes ranges will also be prevented.
  • dragEndFires after the Chart stops panning.
  • zoomStartFires when the Chart starts zooming. If you prevent the event, the Chart will stop zooming.
  • zoomFires while the Chart is zooming. If you prevent the event, the change in the current axes ranges will also be prevented.
  • zoomEndFires when the Chart stops zooming.

In order for the axes to be included in the axisRanges field, provide names to the axes. If an axis range is not changed, the drag and zoom events will not include it.

Example
View Source
Edit In Stackblitz  
Change Theme:

In this article

Not finding the help you need?