Skip to main content
Public

Share visualization

Loading preview…

Fork of Smiley Face Part III

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

Fork of Smiley Face Part III

0
TTarun Kumar Bosupally
Last edited Feb 28, 2024
Created on Feb 28, 2024

This example visualizes a smiley face using React and D3, rendered as SVG with declarative circle and path elements. It shows a red circular face with yellow strokes, two black eyes, and a smile-shaped arc, centered dynamically within a 960×500 viewport. The code imports the `arc` function from D3 v5 to generate the mouth path, computing inner and outer radii and angular extents. React manages the component state and mounts the SVG via `ReactDOM.render`, while D3 handles the geometric calculations. Static data like eye offsets and mouth dimensions are hardcoded, and the drawing stays fully responsive to the fixed canvas size.

AI-generated description

Smiley face implementation with React & D3.

Comments

Sign in to join the discussion.

MIT Licensed