Skip to main content
100%

React + D3 Viz Starter

✓ Published0🌍 Public
WWaseem Medhat
Last edited Dec 9, 2020
Created on Dec 7, 2020

A React starter template demonstrates the margin convention for SVG visualizations, rendering a gray outer rectangle and lighter inner plotting area via the `VizContainer` component. A draggable circle tracks mouse movement using React state and the `onMouseMove` event, with coordinates stored in `mousePos`. The example loads React 16.13.1, ReactDOM, and D3 v6.2.0 from CDN, using JSX and the `useState` hook to manage interactive updates without requiring D3's data-binding utilities.

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