Bowl of Fruit - Click to Select II
✓ Published1🌍 Public
Five fruit circles render as a bowl of apples and lemons, with each fruit colored and sized by `d3.scaleOrdinal` and positioned via a custom `xPos` function. Clicking a fruit highlights its stroke and calls `onClick` to update the selection state. The example uses D3 v6’s data join with `enter`, `merge`, and `exit` selections, animating radius and position through `.transition().duration(1000)`, while `setTimeout` dynamically removes fruits and swaps an apple for a lemon over three seconds. SVG rendering and event listeners are used throughout.
AI-generated descriptionAn example including some commonly used features of SVG.
MIT Licensed