Fork of React + D3 Viz Starter
✓ Published0🌍 Public
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 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