🌍 Public
Viewing a saved revision (read-only)
f6183ca2bb8049fea2a045f7c5b3548e
react first level drilldown map using zoom
This example shows a first-level drilldown map of India that zooms into the selected state or district. Clicking a polygon triggers a smooth zoom animation that fits the clicked region’s bounding box, computed with `d3.geoPath().bounds`, before updating the rendered features. The map uses React state to toggle between state-level and district-level TopoJSON data, loaded via `d3.json`, while `d3.zoom` handles pan and scale transforms on the SVG. The `geoMercator` projection and `geoPath` render the geographic boundaries in a teal fill.
AI-generated descriptionreact first level drilldown map using zoom