Skip to main content
100%

Fork of React + D3 Viz Starter

✓ Published0🌍 Public
PPedram
Last edited Apr 27, 2023
Created on Apr 27, 2023

This example demonstrates a reusable React component called `VizContainer` that abstracts SVG and group elements following the margin convention, rendering a dark outer rectangle, a light inner rectangle, and a pink circle. The code uses React 16 and D3 v6 via CDN links, with props controlling dimensions, margins, and colors. The `showMargins` boolean toggle visually highlights the chart’s margin area, which can be removed by deleting that prop. It serves as a minimal starter template for building React-based D3 visualizations.

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