🌍 Public
Viewing a saved revision (read-only)
c45567e81d3b41e38ef0a2db464836fb
Random Data with React
This example displays a vertical stack of colored horizontal bars, one for each CSS named color, loaded from a remote CSV file. The visualization uses React's `useState` and `useEffect` hooks to asynchronously fetch and store the data with `d3.csv`, then renders each row as a `div` whose background color is set to the hex value from the dataset. The bars are 960 pixels wide and 5 pixels tall, creating a continuous spectrum. The code integrates D3 v7 for data loading with React 16.9 for component rendering and state management.
AI-generated descriptionA program that loads in some data using d3 utilities, and uses React state to keep track of data