All examples By author By category About

mbostock

Programmatic Pan+Zoom

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.