Skip to main content
100%

Fork of React + D3 Viz Starter

✓ Published0🌍 Public
AAditya Kumar Patel
Last edited Nov 11, 2023
Created on Nov 9, 2023

This example shows a stacked bar chart displaying sample invoice data, with categories A, B, and C broken into three value segments. The chart is built with React and D3 v6, using d3.stack to aggregate values, d3.scaleBand and d3.scaleLinear for axes, and d3.scaleOrdinal for color encoding. Bars are rendered as SVG rectangles within a React component, using a Card layout and a VizContainer that follows the margin convention. The code includes commented-out margin visualization props for debugging layout.

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