Zoom + Pan
✓ Published0🌍 Public
Mmbostock
Last edited Apr 9, 2020
Created on Apr 9, 2015
This example demonstrates zooming and panning across a 2D Cartesian coordinate system with visible axes. The view initially centers on the origin, and the user can pan by dragging and zoom by scrolling, with the axis tick marks and grid lines updating accordingly. A "Reset" button restores the original scale and translation. The implementation uses d3.behavior.zoom with linear scales for the x and y axes, and calls the axis render functions within the zoom event handler. The SVG rendering includes a light gray background rectangle and white axis strokes.
AI-generated descriptionA simpler variation of programmatic zoom without the use of transitions.
gpl-3.0 Licensed