Bowl of fruits- General Update Pattern(Nested Version)
This example demonstrates D3’s general update pattern with a nested data join, showing how to manage entering, updating, and exiting groups of fruit shapes. The visualization renders a row of apples and lemons as SVG circles with labels, animating changes over time as fruits are eaten or replaced. The code uses `d3.selectAll` with `data()`, `.enter()`, `.merge()`, and `.exit()` to handle the three states, while `scaleOrdinal` maps fruit types to colors and radii. A `transition()` animates radius adjustments, and `setTimeout` triggers dynamic updates to the dataset.