Skip to main content
100%

Fruit Bowl

✓ Published2🌍 Public
Ggabcoderboi
Last edited Dec 14, 2020
Created on Dec 10, 2020

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 description

React Starter code.

MIT Licensed

Similar vizzes