🌍 Public
Viewing a saved revision (read-only)
06eae08ba43b49a7b7dadfbc053f6064
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