🌍 Public
Viewing a saved revision (read-only)
6015056130ba455c9d845260c5f9a29d
Bowl of Fruit - General Update Pattern Special Cases
MMaarten van 't Wout
Last edited Dec 12, 2019
Created on Dec 12, 2019
This example demonstrates D3’s general update pattern with special cases for entering, updating, and exiting elements in a fruit bowl visualization. Five apples appear initially; one is removed, another is replaced by a lemon, and a third apple is deleted, showing how `selection.join` handles groups via `enter`, `merge`, and `exit`. The code uses `d3.scaleOrdinal` for colors and radii, and appends SVG `rect`, `circle`, and `text` elements. Data is plain JavaScript objects, with updates triggered by `setTimeout` calls.
AI-generated description