Bowl of Fruit - General Update Pattern II
✓ Published0🌍 Public
This example demonstrates the General Update Pattern I with a bowl of fruit, showing how a D3 visualization responds to changes in its underlying data array. Initially five red apples are rendered as circles with labels, then sequentially one fruit is removed, another is updated from apple to lemon, and a third is filtered out, all through timed `setTimeout` calls. The code uses D3 v5's `select` and `scaleOrdinal` APIs, building SVG groups, circles, and text elements within a static HTML document. Colors and radii map qualitatively to fruit types via ordinal scales, while the explicit `exit().remove()` and `.merge()` operations highlight the update lifecycle.
AI-generated descriptionBowl of Fruit - General Update Pattern
MIT Licensed