🌍 Public
Viewing a saved revision (read-only)
054233a2f76741e3bc887e2af74d1dd0
Bowl of Fruit - General Update Pattern
This example demonstrates the D3 general update pattern using a bowl of fruit metaphor. Five apples are drawn as red circles with labels inside a rounded rectangle bowl. Over time, fruits are removed and one apple changes into a lemon, with the chart updating accordingly. The code uses D3 v7 APIs including `scaleOrdinal` for color and radius mappings, and the `selectAll`, `enter`, `merge`, and `exit` methods to handle data changes. The visualization renders as SVG with fruits positioned horizontally based on their array index.
AI-generated description