Skip to main content
100%

Bowl of Fruit - General Update Pattern

✓ Published2🌍 Public
Ccyro666
Last edited Mar 17, 2020
Created on Mar 17, 2020

The bowl of fruit demonstrates D3’s general update pattern, showing how circles enter, update, and exit smoothly with a 500ms transition. Apples and lemons are distinguished by ordinal color and radius scales, while each fruit’s identity is tracked via a random `id`. The `fruitBowl` function uses `selection.merge` and `transition.attr` to animate radius and x-position changes, and an exit transition shrinks removed fruits to zero before deletion. Data mutations—removing an apple, changing one to a lemon, and filtering—are triggered by `setTimeout` in `index.js`.

AI-generated description

Bowl of Fruit demo

MIT Licensed

Similar vizzes