Skip to main content
Public

Share visualization

Loading preview…

Random Data with React

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

Random Data with React

1
Ddiogomirandabarbosa25@gmail.com
Last edited Aug 1, 2024
Created on Aug 1, 2024

This example displays a vertical stack of colored horizontal bars, one for each CSS named color, loaded from a remote CSV file. The visualization uses React's `useState` and `useEffect` hooks to asynchronously fetch and store the data with `d3.csv`, then renders each row as a `div` whose background color is set to the hex value from the dataset. The bars are 960 pixels wide and 5 pixels tall, creating a continuous spectrum. The code integrates D3 v7 for data loading with React 16.9 for component rendering and state management.

AI-generated description

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

Comments

Sign in to join the discussion.

MIT Licensed