Zoom + Pan
A D3.js line chart with grid-like axes supports interactive panning and zooming, controlled by dragging and mouse-wheel gestures. The view resets via a button, triggering a smooth animated transition back to the default domain using `d3.behavior.zoom`, `d3.scale.linear`, and `d3.transition().tween`. The SVG rendering showcases the axis updates, while the button click remaps the scales programmatically and rebinds them to the zoom behavior.
AI-generated descriptionAfter panning or zooming with the mouse, click the "Reset" button in the top-right corner to transition back to the default viewport. This example demonstrates setting the domain of scales attached to a zoom behavior programmatically. After the domains are set, you must rebind them to the behavior.
See also a simpler version without transitions and a version with buttons that zoom around the center.
forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/3892928'>Programmatic Pan+Zoom</a>