🌍 Public
Fork of Fork of Loading Data with React & D3
This example visualizes a dataset of CSS named colors as a pie chart, with each slice filled using its corresponding hexadecimal color value. It loads the data from a remote CSV file using D3’s `csv` function, then manages the async data loading with React hooks (`useState` and `useEffect`). The chart is rendered as SVG paths computed by D3’s `pie` and `arc` generators, with the arc’s outer radius set to the full viewport width, creating a large, color-coded circular layout. React’s `useCallback` is also imported, though not used, and the data is fetched only once on mount.
AI-generated descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React state to keep track of the data.
MIT Licensed
Comments
Sign in to join the discussion.