Skip to main content
Public

Share visualization

Loading preview…

Cheap Tricks for Interaction

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Cheap Tricks for Interaction

0
Ssrrajendran
Last edited Sep 25, 2018
Created on Sep 25, 2018

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 description

Comments

Sign in to join the discussion.

MIT Licensed