Skip to main content
Public

Share visualization

Loading preview…

Let's make a face with D3.js!

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Let's make a face with D3.js!

0
SSnapika
Last edited Feb 20, 2022
Created on Feb 19, 2022

This example demonstrates fundamental DOM manipulation with D3.js by constructing a smiley face from SVG shapes, including a gold circle face, two black eyes with lightblue outlines, and a brown-stroked mouth drawn using the d3.arc() path generator. The face is centered within a 960×500 SVG canvas, with eye positions calculated relative to the canvas dimensions. The code uses d3.select() and chained .attr() methods to create and style each element, while a group element with a transform attribute aligns the mouth correctly.

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