Bowl of fruit - click to select
✓ Published3🌍 Public
A bowl of fruit demonstrates a join-based update pattern in D3 v5. Circles represent apples and lemons, scaled by fruit type via `scaleOrdinal`, with the selected fruit highlighted by a black stroke. Clicking a circle triggers a callback that updates the selection and re-renders the visualization. Transitions animate new circles growing from radius zero, exiting circles shrinking away, and position changes over one second. The example uses `selection.data`, `.enter()`, `.merge()`, and `.exit()` to manage enter, update, and exit states, with SVG rendering and an animation showing data changes over time.
AI-generated descriptionMIT Licensed