🌍 Public
Viewing a saved revision (read-only)
ae6076afb5ff46c38cfd3258b5de7096
General Update Pattern for Nested Items
Animated fruit bowl demonstrates the general update pattern for nested selections in D3. Circles and labels enter, update, and exit as fruits are added, removed, or change type. The code uses `selection.enter()`, `merge()`, and `exit().remove()` with key functions on `d.id`. Transitions via `transition().duration()` animate radius changes, while `scaleOrdinal` maps fruit types to colors and sizes. The example runs scripted `setTimeout` changes to drive the updates.
AI-generated description