Skip to main content

Pan and Zoom

Use VictoryZoomContainer to add panning and zooming behavior to any Victory components that work with an x-y coordinate system.

See the full API here.

Basic

In the example below, an initial domain is set with the zoomDomain prop. This prop may also be used to trigger pan and zoom behavior from other components.

Live View
Loading...
Live Editor

Limits

The allowZoom and allowPan props may be used to restrict zooming and panning behavior. In the example below, zooming is disabled, but panning is allowed.

Live View
Loading...
Live Editor

Combined with Brushing

In the next example, VictoryZoomContainer and VictoryBrushContainer are used to create a zoomable chart with a mini-map brush control. Here, the onZoomDomainChange prop on VictoryZoomContainer alters the brushDomain prop on VictoryBrushContainer tying highlighted brush region of the mini-map to the zoom level of the chart. The onBrushDomainChange prop on VictoryBrushContainer alters the zoomDomain prop on VictoryZoomContainer so that the zoomed level of the chart matches the highlighted region of the mini-map.

info

For more information on brushing, see the Data Selection guide.

Live View
Loading...
Live Editor

Like this project? You'll love working with us.

Contact us to learn more about our full range of services and offerings.

Learn More