Untitled
✓ Published8🌍 Public
This example shows an interactive map of Canada where hovering over a province highlights it in red and displays a tooltip with the province name. The tooltip follows the mouse position and is hidden on mouseout. The map is rendered as SVG paths using D3 v7’s `d3.geoPath` with a `d3.geoAlbers` projection, and the geographic data comes from a GeoJSON file hosted on GitHub. CSS classes control the hover color change and tooltip visibility.
AI-generated descriptionAn example showing hovering on a map:
- Loads d3v7 via UNPKG.
- Loads map of Canada
- On mouse move :
- shows a div by modifying its css properties
- modifies the content and position of a div (the tooltip)
- changes the css class of the state to change its color
- On mouse out :
- hides the tooltip div
MIT Licensed