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
MMeghan Maloy
Last edited Jun 16, 2020
Created on Jun 16, 2020

This example builds a simple yellow face in an SVG using D3.js v5 within a React framework. It shows how to compose basic geometric shapes—a circle for the head, smaller circles for eyes, rectangles for eyebrows, and a path generated with D3’s `arc` helper for the mouth—positioned relative to the SVG’s center. The code directly selects the SVG element via `select`, reads its dimensions, and applies a transform to center a group, while hardcoded offsets place facial features symmetrically. The rendering relies purely on SVG attributes, with no data binding or external datasets involved.

AI-generated description

React Starter code.

Comments

Sign in to join the discussion.

MIT Licensed