Example of Zooming and Panning in React Chart Component

/
/
Zooming

This sample demonstrates the zooming and panning features of the charts.

More Details...

Loading....
Description

The chart component supports four types of zooming, which can be configured using the enableSelectionZooming, enablePinchZooming, enableMouseWheelZooming, and enableDeferredZooming properties. This sample demonstrates the following zooming and panning behaviors:

  • Selection Zooming : Click and drag the mouse over the chart area to enable selection zooming.
  • Toolbar : Hover over the toolbar at the top-right corner of the chart area to switch between zooming and panning.
  • Pinch Zooming : Pinch in or pinch out on the chart area to zoom in or out on touch-enabled devices.
  • Panning : Touch and drag to pan the chart.
  • Reset Zoom : Double-tap to reset the zoomed chart.

The chart also supports different zooming modes, which can be configured using the mode property.

  • XY - Zoom the chart with respect to both axes.
  • X - Zoom the chart with respect to the horizontal axis only.
  • Y - Zoom the chart with respect to the vertical axis only.

The toolbarPosition property is used to adjust the position of the zoom toolbar. In this example, the toolbar is moved 60 pixels upward from its default position. The draggable property is used to drag and drop the zoom toolbar to any position within the chart area

Injecting Module

Chart component features are segregated into individual feature-wise modules. To use zooming, we need to inject Zoom module using Chart.Inject(Zoom) method.

More information on the Zooming can be found in this documentation section.