Bowl of Fruit - General Update Pattern Special Cases
A bowl of fruit demonstrates special cases in D3's general update pattern, first showing a row of five apples that are dynamically removed, replaced, or filtered over time. Using d3.select and d3.range, the code initializes the SVG, then a custom fruitBowl function handles the enter, update, and exit stages for each fruit group. Circles and text labels are appended to group elements, with ordinal scales (d3.scaleOrdinal) mapping fruit types to colors and radii. The bowl itself is a rounded rectangle, and the update logic responds to array mutations triggered by setTimeout.