Bowl of Fruit - Nested Version of General Upate Pattern
This example demonstrates the general update pattern in D3.js, showing how data joins handle entering, updating, and exiting elements. A bowl of fruit (rendered as circles) initially contains five apples; over time, fruits are removed, a lemon replaces an apple, and a specific fruit is filtered out. Using `selection.enter()`, `selection.merge()`, and `selection.exit()`, the nested SVG groups update their positions and styles via ordinal scales for color and radius. The code relies on D3 v5’s `scaleOrdinal` and manual timeouts to trigger state changes, with SVG rendering for all visual elements.