General Update Pattern - Homework
This example demonstrates the General Update Pattern for animated data transitions, showing a sequence of fruit-bowl modifications over time: five apples appear, one is eaten, an apple transforms into a lime, and another apple is removed. The visualization uses D3’s selection chaining with `.merge()`, `.transition()`, and `.duration()` to smoothly interpolate positions and styling, while ordinal color and radius scales map fruit types to visual properties. The code explicitly handles entering, updating, and exiting elements via `.enter()`, `.exit()`, and `.remove()`, with a 2-second transition on transform and a longer 6-second text fade.