Skip to main content
100%

Untitled

✓ Published0🌍 Public
Ssnehareddygurram
Last edited Apr 9, 2023
Created on Apr 9, 2023
Forked from Untitled

This example presents an interactive map of Canada that displays a tooltip with the name of each province on hover. The map is rendered as SVG using d3.v7, with province shapes generated via `d3.geoPath` and the Albers projection. On mouse movement over a province, a styled `div` tooltip is positioned and populated with the province’s name, while the province’s CSS class changes its fill color; on mouse-out, the tooltip is hidden. The geographic data is loaded as JSON from a remote gist.

AI-generated description

An 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

Similar vizzes