Skip to main content
100%

Let's make a face with D3.js

✓ Published0🌍 Public
Nnedsons
Last edited Oct 17, 2020
Created on Oct 17, 2020
Forked from Making a varchart

This example shows a simple cartoon face built from three circles—a yellow head and two black eyes—rendered as SVG. The face is centered within a 960x500 viewport, with eye positions fixed relative to the center. Using D3 v6’s `select` and `append` API, the code reads the SVG’s width and height attributes to compute coordinates dynamically. No data is loaded; instead, dimensions are derived from the SVG element itself, with eye spacing and vertical offset hardcoded. The styling comes from a minimal external stylesheet that removes page margins.

AI-generated description

React Starter code.

MIT Licensed

Similar vizzes