Skip to main content
100%

Fork of React + D3 Viz Starter

✓ Published0🌍 Public
UUlbert Alain Odle
Last edited Oct 10, 2021
Created on Oct 10, 2021

This example shows a minimal React and D3.js visualization starter with a blank SVG canvas ready for custom charts. The code imports React, ReactDOM, and d3.v6 via CDN, then defines a reusable `VizContainer` component that creates an SVG group element following the standard margin convention. The component accepts props for width, height, margins, and inner dimensions, and renders optional gray and light-gray rectangles when the `showMargins` prop is true to visualize the chart area boundaries. The main `App` component renders the container with fixed dimensions and empty child elements.

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