🌍 Public
Viewing a saved revision (read-only)
8a8cf8a1c6db4eb3b71f5ae380d8eb32
Making a Bar Chart with React & D3 P1
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 descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data as a radial burst!