Skip to main content
100%

Axes with React and D3

✓ Published1🌍 Public
LLainu Kuruvilla
Last edited Jan 14, 2022
Created on Jan 13, 2022

This example shows the top 10 most populous countries as a horizontal bar chart, using D3 scales and React state to render axes and bars as SVG elements. The x-axis is generated manually from `d3.scaleLinear().ticks()`, while the y-axis uses a `d3.scaleBand` domain, with both axes and rectangles rendered via React components. Population data comes from a CSV file loaded through `d3.csv` and filtered with `.slice(0, 10)`. The chart lacks axis labels and gridlines, but displays tick marks and country names positioned with SVG transforms.

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.

MIT Licensed

Similar vizzes