Skip to main content
100%

Making a Bar Chart with React & D3 P1

✓ Published1🌍 Public
MMarta
Last edited Feb 5, 2023
Created on Feb 5, 2023

This example shows a horizontal bar chart of the top ten countries by population in 2020, rendered as an SVG via React. It loads CSV data from a GitHub gist using D3’s `csv` utility, then maps the data to `rect` elements inside a `<g>` group. The scales—`scaleBand` for countries and `scaleLinear` for population—are created with D3 v5, while React’s `useState` and `useEffect` manage the asynchronous data fetch and re-render. The chart displays no axes or labels, focusing solely on the bars’ lengths.

AI-generated description

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

MIT Licensed

Similar vizzes