🌍 Public
Viewing a saved revision (read-only)
882b7607cf15487a940bf3b77a2e199d
Bowl of Fruit - General Update Pattern
This example demonstrates the general update pattern in D3 for managing dynamic data. It renders a bowl of fruit as SVG circles, where apples and lemons are represented by different colors and sizes. The visualization animates through a sequence of state changes: removing an apple, replacing one apple with a lemon, and filtering out another. The code uses `selection.enter()`, `selection.merge()`, and `selection.exit()` to handle data joins, along with D3’s `scaleOrdinal` for color and radius mappings. User clicks select a fruit, which receives a black stroke.
AI-generated description