Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a bar chart with React and D3

Public visualization

Viewing a saved revision (read-only)

7549995bb28b4111906dbd9bae4e9635

Making a bar chart with React and D3

0 stars1🌍 Public
LLewis Ward
Last edited Jun 30, 2021
Created on Jun 27, 2021
Forked from D3 arcs

This example displays a horizontal bar chart of the five most populous countries, using data from a CSV file that is loaded via D3’s `csv` utility. React’s `useState` and `useEffect` hooks manage the asynchronous data loading, while the chart itself is rendered as SVG rectangles. The scales are created with `d3.scaleBand` and `d3.scaleLinear`, and the bar widths are proportional to the population values. The visualization is built with React and D3 v7, with the graphic element rotated by a degree value, though the rotation animation is commented out.

AI-generated description

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