Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bowl of Fruit - General Update Pattern Special Cases

Public visualization

Bowl of Fruit - General Update Pattern Special Cases

0 stars1🌍 Public
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

Comments

Sign in to join the discussion.

MIT Licensed