Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
Ss-janibekova
Last edited Nov 4, 2019
Created on Nov 4, 2019

A D3.js example demonstrates DOM manipulation by rendering a row of five apples as red circles in an SVG, then animating their removal and a color change over time. Using `d3.select`, `d3.range`, and `d3.scaleOrdinal`, the code maps fruit types to fill colors and radii. A `render` function binds data to circles via `selection.selectAll` and `data`, handling enter, update, and exit selections. A `setTimeout` removes an apple after one second, and another changes one to a lemon after 2.5 seconds, showcasing dynamic updates with D3 v5.

AI-generated description

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

MIT Licensed

Similar vizzes