🌍 Public
Viewing a saved revision (read-only)
ffca73ed824241c7973be120c9f3e328
Bowl of Fruit - General Update Pattern
This example demonstrates the general update pattern in D3, showing how data joins manage enter, update, and exit selections. Circles represent fruit types—apples and lemons—with color and radius mapped via `d3.scaleOrdinal`, while `xPosition` spaces them horizontally. Using `d3.selectAll`, `data`, and `merge`, the code transitions new and existing SVG circles with `transition().duration()`, and exit selections shrink and remove themselves. The animation sequence, driven by timed `setTimeout` calls, removes, replaces, and filters fruit objects, highlighting dynamic data updates.
AI-generated descriptionAn example including some commonly used features of SVG.