Skip to main content
100%

Fork of React + D3 Viz Starter

✓ Published0🌍 Public
HHung Mai
Last edited Dec 6, 2023
Created on Dec 6, 2023

This example shows a minimal React + D3 visualization starter template with an empty SVG canvas and visible margin guides. The `VizContainer` component abstracts SVG and group elements, following the margin convention to position inner content. It uses React 16.13.1 and d3.v6, rendering through SVG with dimensions set to 960 by 500 pixels. The code defines margin variables and passes width, height, and inner dimensions as props, with a toggleable `showMargins` prop to display or hide the margin rectangles.

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