block by mbostock 3892928

Programmatic Pan+Zoom

Full Screen

After 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.

Updated Example →