🌍 Public
Viewing a saved revision (read-only)
e4fe9d021ce040cfbc40a3a511b2f918
Loading Data with React and D3
This example demonstrates how to load and summarize a CSV dataset within a React application, displaying the row count, column count, and file size in kilobytes. The code uses React’s `useState` and `useEffect` hooks to manage the asynchronous loading state, while D3’s `csv` function fetches the data from a GitHub gist. Once loaded, a custom `message` function formats the summary using `d3.csvFormat` to compute the byte size, and the result is rendered as large text. The visualization is purely textual, showing loading progress until the data arrives.
AI-generated descriptionA program that loads data with d3 utilities and use react state to keep track of the data