Skip to main content
100%

click-to-zoom via transform

✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 5, 2018
Created on Jan 5, 2017

Clicking a US state smoothly zooms the map to that state, centering it and enlarging it fourfold; clicking again restores the full national view. The example builds an interactive state map with D3, using `d3.geo.albersUsa` for the projection and `topojson` to process geographic data. Zoom animation is driven by D3 transitions, which update an SVG `g` element’s `transform` attribute and adjust the stroke width to maintain visual consistency. State borders and a clickable background rect facilitate the interaction, with active states highlighted in orange.

AI-generated description

Part of a series of examples. See:

  1. mousewheel-zoom + click-to-center via projection
  2. click-to-center via projection
  3. click-to-center via transform
  4. click-to-zoom via transform

More recently, see the Zoom to Bounding Box example.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/2206590'>click-to-zoom via transform</a>

gpl-3.0 Licensed

Similar vizzes