d3 Starter Bowl of Fruit - General Update Pattern
This example demonstrates the "general update pattern" in D3.js v5 by rendering a static bowl of fruit—a set of apples and a lemon—as SVG shapes. The visualization dynamically updates the fruit bowl through a series of timed events, removing apples, replacing one with a lemon, and filtering out another, using the `selectAll`, `enter`, `merge`, and `exit` methods (e.g., `selection.selectAll('g').data(fruits)`, `groups.enter().append('g')`) to handle element creation, updating, and removal. The code uses D3's `scaleOrdinal` for color and radius mapping, with the SVG rendered directly as `rect`, `circle`, and `text` elements. Data is generated via `range(5)` and `makeFruit` functions, reacting to `setTimeout` callbacks that call `render()`.