Skip to main content
Public

Share visualization

Loading preview…

Loading Data with React & D3

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Loading Data with React & D3

1
MMinh Luong
Last edited Jan 8, 2022
Created on Jan 8, 2022
Forked from Mouse Follower

This example demonstrates loading and displaying CSS named colors as vertical color stripes, with data fetched asynchronously from a remote CSV file. The React component uses the `useState` and `useEffect` hooks to manage the data-loading state, showing a “Loading…” message until the data arrives. It employs D3’s `csv` function to parse the external dataset, then maps each row to a styled `<div>` element whose background color corresponds to the `RGB hex value` column. The visualization updates dynamically once the data is ready, rendering 148 color swatches in a full-width strip.

AI-generated description

A program that loads in some data using D3 utilities, and uses React state to keep track of the data.

Comments

Sign in to join the discussion.

MIT Licensed