🌍 Public
Viewing a saved revision (read-only)
482d03775337472eb5af9bf104b7f87a
Bowl of Fruit - General Update Pattern Special Cases
Ss-janibekova
Last edited Nov 20, 2019
Created on Nov 4, 2019
The bowl of fruit demonstrates special cases of D3’s general update pattern, showing how enter, update, and exit selections handle data changes. Five apples are drawn as circles with text labels; then an apple is removed, another is swapped for a lemon, and a third is filtered out. The code uses `d3.selectAll`, `data`, `enter`, `merge`, and `exit` to manage SVG groups, with `scaleOrdinal` mapping fruit types to radii and colors. The animation runs via `setTimeout`, with each step re-rendering the bowl shape and fruit positions.
AI-generated description