Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Axes with React & D3

Public visualization

Axes with React & D3

0 stars0🌍 Public
Ggcappadaniel
Last edited Oct 23, 2020
Created on Oct 23, 2020

A bar chart displays the top 10 most populous countries using data from the United Nations World Population Prospects 2019. The React component fetches the CSV with `d3.csv`, converts the population column to numbers, and slices the data. It builds scales with `d3.scaleBand` for countries and `d3.scaleLinear` for population values. Custom axes are rendered as SVG `<g>` elements, with `xScale.ticks()` generating grid lines and tick labels, while y-axis labels are positioned manually. The visualization uses React state with `useState` and `useEffect` to manage asynchronous loading, and renders all marks as SVG `<rect>` elements.

AI-generated description

A program that shows the top 10 most populous countries as a pathetic bar chart with no axes.

Data: United Nations World Population Prospects 2019.

Comments

Sign in to join the discussion.

MIT Licensed