Let's make a face with D3.js!
✓ Published2🌍 Public
This example demonstrates fundamental DOM manipulation with D3.js by building a smiley face whose eyebrows move in response to button clicks. The page provides "Add Data" and "Remove Data" buttons that trigger animated updates to the face’s features. The code uses d3.select to target the SVG element, d3.scaleLinear with d3.interpolateHcl for color transitions, and d3.pack to flatten hierarchical data into circle layouts. The rendering relies on SVG elements and D3’s enter/exit pattern, with animations driven by D3 transitions. The data comes from a nested JSON hierarchy (flare dataset) that is visualized through the packing layout.
AI-generated descriptionDemonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.
MIT Licensed