Bowl of Fruit - Hover to select
✓ Published0🌍 Public
Five pieces of fruit sit in a row on an SVG canvas, rendered as colored circles whose radius and fill depend on fruit type via `d3.scaleOrdinal`. Hovering a circle triggers a `mouseover` event that calls `setSelectedFruit`, updating a black stroke to highlight the selection. Animations use `selection.transition()` with a 1000-millisecond duration to smoothly move, resize, or remove circles when the data array changes over time. The code imports `scaleOrdinal` from D3 v5 and uses a data join with keyed functions to manage enter, update, and exit selections.
AI-generated descriptionMIT Licensed