Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Let's make a face with D3.js!

Public visualization

Let's make a face with D3.js!

0 stars0🌍 Public
ZZhang Shengli
Last edited Sep 26, 2019
Created on Sep 26, 2019

This example demonstrates fundamental D3.js data joins and DOM manipulation by rendering a row of five fruit-colored circles that update when data changes. It uses `d3.select`, `d3.range`, and `d3.scaleOrdinal` to map fruit types to colors, with `selection.enter()`, `merge()`, and `exit()` to handle adding, updating, and removing SVG circles. After an initial render, a pop removes one circle, and a subsequent change re-colors the middle circle from red to yellow, showing dynamic updates driven by array mutations.

AI-generated description

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

Comments

Sign in to join the discussion.

MIT Licensed