🌍 Public
Viewing a saved revision (read-only)
3dbe396199ad4fde871d6a3853b9c519
Bowl of Fruit - General Update Pattern .js
Five apples render as circles in an SVG bowl, then transition through a sequence of state changes: an apple is removed, another apple transforms into a lemon, and a third apple disappears. The example demonstrates D3’s general update pattern using `selection.data()`, `enter`, `merge`, and `exit` selections, with `transition().duration()` animating circle radii and positions. Ordinal scales map fruit type to fill color and radius, while each fruit’s unique `id` keys the data join. Random IDs from `Math.random()` generate the dataset.
AI-generated descriptionA