Bowl of Fruit - General Update Pattern Special Cases
This example demonstrates the D3 general update pattern through a bowl of fruit, where apples and lemons are added, removed, or changed over time to show how enter, update, and exit selections handle data changes. The visualization uses d3.scaleOrdinal for color and radius mapping, with SVG circles and text elements positioned in a fixed bowl shape. The code explicitly uses selection.merge, selection.exit().remove(), and setTimeout to sequence transformations, illustrating special cases like filtering out an item or mutating a datum’s type property while preserving existing DOM nodes.