Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

General Update Pattern for Nested Items

Public visualization

Viewing a saved revision (read-only)

06eae08ba43b49a7b7dadfbc053f6064

General Update Pattern for Nested Items

0 stars1🌍 Public
MMatt Morris
Last edited Feb 7, 2019
Created on Feb 5, 2019

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