Skip to main content
100%

v2_Loading data with React and D3

✓ Published1🌍 Public
SsunilthkGmail
Last edited Jan 23, 2023
Created on Jan 23, 2023

This example demonstrates how to load and display a dataset within a React application using D3.js. It fetches a CSV file of CSS color names and hex values from a GitHub Gist, then renders each row as a small colored div. The code uses D3's `csv` function for data parsing and React's `useState` and `useEffect` hooks to manage asynchronous loading. Console logging confirms the fetched data structure, while a separate `getMessage` module calculates and displays the dataset's size in kilobytes, row count, and column count.

AI-generated description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes