Skip to main content
100%

axis with d3

✓ Published1🌍 Public
GGuitong Li
Last edited Feb 5, 2022
Created on Feb 5, 2022

This visualization displays a horizontal bar chart of population data for the world’s most populous countries, with each bar labeled by country name. The bars are rendered as SVG rectangles within a React component, using D3’s `scaleBand` for the categorical y-axis and `scaleLinear` for the numerical x-axis. Axes are manually constructed by mapping over `xScale.ticks()` to draw grid lines and tick labels, while country names are positioned using the band scale’s bandwidth. Population values come from a CSV file loaded via `d3.csv`.

AI-generated description

This bar chart shows population of the top 10 most populous countries. The data comes from the year 2018 estimate in United Nations: World Population Prospects 2017. It also demonstrates customization of D3 axes.

See also the first bar chart visualization that this one builds on: Making a Bar Chart.

MIT Licensed

Similar vizzes