Bowl of Fruit - General Update Pattern Special Cases
This example demonstrates D3’s general update pattern with special cases for handling dynamic data changes in an SVG visualization. It shows a bowl of fruit where apples and lemons are added, removed, or replaced over time, with circles and text labels updating accordingly. The code uses `d3.scaleOrdinal` for color and radius mapping, and employs selection methods like `enter()`, `merge()`, and `exit()` to manage DOM updates. Data comes from an array of fruit objects modified through `pop()` and `filter()`, triggering re-renders via `setTimeout`.