Skip to main content
100%

Fork of React + D3 Viz Starter

✓ Published0🌍 Public
Mmfakboo
Last edited May 26, 2021
Created on May 26, 2021

This example shows a minimal React + D3.js visualization scaffold with a flexible `VizContainer` component that wraps SVG elements using the standard margin convention. It renders gray rectangles to visualize the outer and inner chart areas, which can be toggled via the `showMargins` prop. The code uses React 16 for component rendering, ReactDOM for mounting, and D3 v6 loaded via CDN, with fixed dimensions of 960×500 pixels. The container abstracts the SVG `<g>` transform for margins, allowing children to be placed directly in the plotting area, though no actual data marks are present yet.

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