Fork of React + D3 Viz Starter
✓ Published0🌍 Public
This example presents a React starter template for integrating D3 visualizations within a margin-convention layout. The `VizContainer` component abstracts the SVG and group elements, optionally rendering gray background rectangles to highlight the margins. The visible visualization is a simple bar chart generated by the `barChart` function, which uses `d3.create` and `d3.selectAll` to render div elements with steelblue backgrounds sized proportionally to each data value. The app mounts via `ReactDOM.render`, and the code relies on CDN-loaded React 16 and D3 v6.
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