Fork of React + D3 Viz Starter
✓ Published0🌍 Public
This example provides a minimal React + D3 starter template for building SVG visualizations. It renders a blank 960x500 SVG canvas with gray margin rectangles visible through the `VizContainer` component, which follows the D3 margin convention using explicit width, height, and margin objects. The code loads React 16, ReactDOM, and D3 v6 via CDN, then uses JSX to compose the SVG structure. The `showMargins` prop toggles the display of the outer and inner guide rectangles, demonstrating how to scaffold a chart before adding custom D3 visualizations.
AI-generated descriptionBoilerplate code for a React + D3 visualization with:
- CDN links for React, ReactDOM, and D3
- Basic React boilerplate
- Variables for dimensions and margins
- A
VizContainercomponent 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