Skip to main content
100%

Fork of React + D3 Viz Starter

✓ Published0🌍 Public
RRutvik Kokate
Last edited Dec 2, 2023
Created on Dec 2, 2023

This example demonstrates a clean React and D3.js starter template that sets up a basic SVG visualization container. It renders two nested rectangles—an outer gray rectangle and an inner light gray rectangle—to visualize the margin convention. The `VizContainer` React component abstracts the SVG and group elements, accepting props for dimensions and margins, with an optional `showMargins` prop to toggle the rectangles. Built with React 16.13 and D3 v6 loaded via CDN, it provides a minimal foundation for building custom charts.

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