Skip to main content
100%

Smile Part 1

✓ Published0🌍 Public
Ssamsangraula
Last edited Jan 10, 2022
Created on Jan 10, 2022

This example draws a static smiley face using raw SVG shapes within a React application. The code renders three circles—a large yellow face with a black stroke, and two smaller black eyes—directly in the JSX markup of the HTML file. It uses React and ReactDOM from CDN links, with D3 loaded but not actively used for any data or simulation. The visualization follows a margin convention through a custom `VizContainer` component, which abstracts the SVG group structure and can display margins via a `showMargins` prop.

AI-generated description

Boilerplate code for a React + D3 visualization with:

  • CDN links for React, ReactDOM, and D3
  • Basic React boilerplate
  • Variables for dimensions and margins
  • A VizContainer component that:
    • Abstracts SVG/group container elements
    • Follows the margin convention
    • Show the margins, which can be easily removed by deleting the showMargins={true} prop
MIT Licensed

Similar vizzes