🌍 Public
Viewing a saved revision (read-only)
914af5f1f1ed42a481dab0773d054e3e
Bowl of Fruit - General Update Pattern Special Cases
Hhuankoh
Last edited Oct 25, 2020
Created on Oct 25, 2020
A bowl of fruit demonstrates D3's general update pattern with special cases, showing how data joins handle enter, update, and exit selections for apples and lemons. D3 v5's selection methods—`merge`, `exit().remove()`, and nested selections—manage circle and text elements across four timed transitions: adding apples, removing one, replacing an apple with a lemon, and filtering a specific index. The code uses `scaleOrdinal` for color and radius mapping, rendering SVG shapes within a static bowl rectangle, with each state change triggered by `setTimeout`.
AI-generated description