Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Bar Chart with React & D3

Public visualization

Making a Bar Chart with React & D3

0 stars1🌍 Public
Jjwlam83
Last edited Jan 13, 2022
Created on Jan 12, 2022

This example shows a horizontal bar chart of the top ten countries by 2020 population, rendered as SVG with React. The code loads UN population data from a CSV file using `d3.csv` and transforms each row by parsing the “2020” field. React’s `useState` and `useEffect` manage data loading, while D3 scales `scaleLinear` and `scaleBand` map population values and country names to pixel positions. Each bar is a `<rect>` element generated by mapping over the data array inside a React component.

AI-generated description

A program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data

Comments

Sign in to join the discussion.

MIT Licensed