Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

react first level drilldown map using zoom

Public visualization

Viewing a saved revision (read-only)

f6183ca2bb8049fea2a045f7c5b3548e

react first level drilldown map using zoom

1 star8🌍 Public
AAnimesh Nautiyal
Last edited Feb 23, 2023
Created on Oct 16, 2020

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 description

react first level drilldown map using zoom