Skip to main content
Public

Share visualization

Loading preview…

Fork of Bowl of Fruit - Hover to Select

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

Fork of Bowl of Fruit - Hover to Select

0
TToooooooT
Last edited Sep 18, 2022
Created on Sep 18, 2022

A fork of the Bowl of Fruit example demonstrates an interactive data join with D3 v7. The visualization renders apples and lemons as SVG circles, which animate their radius and x-position using `transition().duration(1000)` as fruits are added, removed, or replaced. Hovering over a circle triggers a `mouseover` event, invoking `setSelectedFruit` to highlight it with a black stroke; moving the mouse away clears the selection. The code uses D3’s `scaleOrdinal` for color and radius mappings, with a keyed `data` join on fruit IDs to track elements across updates.

AI-generated description

A demonstration of how to start using D3 version 6.

Comments

Sign in to join the discussion.

MIT Licensed