Cheap Tricks for Interaction
✓ Published0🌍 Public
This example demonstrates how a simple map of world countries can be made interactive through basic selection and styling. A Natural Earth projection, built with `d3.geoNaturalEarth1` and `d3.geoPath`, renders country boundaries from TopoJSON data enriched with names from a TSV file. Clicking a country toggles its class from `country` to `selectedCountry`, changing its fill to brown via CSS, while hovering turns it red. The interaction relies on D3 v5’s event handling and class manipulation, without complex zoom or panning logic.
AI-generated descriptionMIT Licensed