Skip to main content
100%

Loading Data for Visualisation with d3 & React

✓ Published0🌍 Public
MMrinal Roy
Last edited Mar 18, 2021
Created on Mar 18, 2021

This example demonstrates a pie chart of CSS named colors, where each slice is a distinct color fetched from a remote CSV file. The code combines React’s `useState` and `useEffect` hooks to load the data asynchronously, displaying a loading message until the CSV arrives. Using D3’s `csv` parser and `arc` generator, it renders each color as an SVG path inside a `<g>` element centered on the canvas. The visualization highlights the seamless integration of D3 utilities with React state management for data-driven SVG rendering.

AI-generated description

A program that loads in some [data about CSS named colors] (https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) D3 utilities and uses React state to keep track of data.

MIT Licensed

Similar vizzes