Skip to main content
100%

practice10--click

✓ Published1🌍 Public
DDi Cui
Last edited May 21, 2023
Created on May 20, 2023

This example shows a fruit bowl visualization where apples and lemons are rendered as colored circles, and clicking a fruit highlights it with a black stroke while updating a selection state. The code uses D3.js v5 with a data join pattern to bind fruit objects to SVG circles, applying ordinal scales for color and radius, and transitions to animate circles entering, exiting, and changing size. A timer sequence removes apples, replaces one with a lemon, and filters data to demonstrate dynamic updates. The interaction and rendering rely on `d3.select`, `scaleOrdinal`, and `transition` APIs.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

MIT Licensed

Similar vizzes