Bowl of Fruit - General Update Pattern Special Cases
A Bowl of Fruit demonstrates the general update pattern in D3.js, including special cases for enter, update, and exit selections. The code uses d3.selectAll, data joins, and merge operations to add, remove, or modify fruit elements in an SVG canvas. Each fruit is rendered as a circle with a label, colored via d3.scaleOrdinal based on type (apple or lemon). The example runs through a timed sequence of state changes—initial apples, then removal, replacement, and filtering—to show how the visualization responds to dynamic data updates.