Skip to main content
Public

Share visualization

Loading preview…

Fork of React + D3 Viz Starter

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Fork of React + D3 Viz Starter

0
RRory Matthews
Last edited Oct 8, 2021
Created on Oct 8, 2021

This example demonstrates a minimal React + D3 starter template that renders an empty SVG visualization with visible margin areas. The code uses CDN-loaded React 16, ReactDOM, and d3.v6 to construct a reusable `VizContainer` component that abstracts SVG group elements and follows the standard margin convention. It passes explicit `width`, `height`, and `margin` props to draw light-gray outer and inner rectangles, which can be hidden by removing the `showMargins` prop. The visualization currently shows only the container scaffolding, ready for D3 visual elements.

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

Comments

Sign in to join the discussion.

MIT Licensed