🌍 Public
Viewing a saved revision (read-only)
5c5df898246d4de4864c70f772883b5e
Fruit Bowl
This example shows a fruit bowl where five apples shrink and disappear over time, with one apple turning into a lemon. The data-driven update pattern uses D3’s data joins to handle enter, update, and exit selections for SVG circles and text labels. The code relies on `scaleOrdinal` for color and radius mappings, and `selection.merge` to apply shared attributes across entering and updating elements. The React starter structure wraps the D3 logic in a reusable `fruitBowl` function, rendering to an `<svg>` element with fixed dimensions.
AI-generated descriptionReact Starter code.