Bowl of Fruit - General Update Pattern
✓ Published2🌍 Public
This example demonstrates the general update pattern for data joins in D3, animating a bowl of fruit as apples are removed and transformed into lemons over time. The visualization uses a React-like component structure, with a reusable `fruitBowl` function that handles enter, update, and exit selections via `selection.selectAll('circle').data(fruits, d => d.id)`. The code explicitly uses D3 v5 APIs including `scaleOrdinal` for color and radius mappings, `transition().duration(1000)` for smooth animations, and `merge` to combine enter and update selections. The initial five apples pop in with a radius of zero, then exit by shrinking back down.
AI-generated descriptionA bare minimum HTML page.
See also React Starter.
MIT Licensed