Skip to main content
100%

Pathetic Population Bar Chart

✓ Published1🌍 Public
Kkalmdown
Last edited Aug 10, 2021
Created on Jul 30, 2021

This example displays the top ten countries by 2020 population as a horizontal bar chart, with bar lengths proportional to population size. The chart loads data from a CSV file hosted on GitHub using D3’s `csv` function, then maps the data to SVG rectangles via React’s `useState` and `useEffect` hooks. D3’s `scaleBand` and `scaleLinear` position the bars within a fixed 960-by-500 pixel viewport, while the `max` function determines the scale’s upper bound.

AI-generated description

Graphing population data

MIT Licensed

Similar vizzes