Skip to main content
100%

React + D3 Viz Starter

✓ Published123🌍 Public
WWaseem Medhat
Last edited Dec 8, 2020
Created on Dec 5, 2020
Forked from HTML Starter

This example presents a blank React + D3 starter template that establishes the foundational structure for a visualization. It uses CDN-loaded React 16.13.1, ReactDOM, and D3 v6.2.0 to render an SVG via the `VizContainer` component, which applies the margin convention and abstracts the outer and inner rectangle elements. The code defines explicit width, height, and margin variables, and the component conditionally displays the margins based on a `showMargins` prop. The rendered output is an empty SVG with grey and light-grey rectangles, ready for chart content.

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