Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Pathetic Population Bar Chart

Public visualization

Viewing a saved revision (read-only)

3ad1407b73d24701b1dabd0fd699b071

Pathetic Population Bar Chart

0 stars1🌍 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