Skip to main content
100%

Fork of Loading Data with React & D3

✓ Published1🌍 Public
KK3zter
Last edited Dec 17, 2021
Created on Dec 17, 2021

This example shows a React component that loads a CSV file of named colors using D3 and renders each color as a horizontal stripe, creating a full-width stacked bar visualization. The `useState` and `useEffect` hooks manage the asynchronous data loading, displaying a “Loading…” message until the data arrives. The code uses `d3.csv` to fetch the dataset from a GitHub gist, then maps over the parsed rows to generate div elements with inline styles for background color, width, and height. React 17 and D3 v7 are loaded from CDNs, with rendering handled by `ReactDOM.render`.

AI-generated description

Loads in some data using D3 and uses react state to track the data

MIT Licensed

Similar vizzes