Skip to main content
100%

Datavis 2020 Episode 22 - Margins and Axes

✓ Published1🌍 Public
RRichard Burd
Last edited Jan 23, 2022
Created on Jan 23, 2022

This example shows a horizontal bar chart of the top ten countries by 2020 population, with bars extending from a shared left axis and value labels along the bottom. The chart uses React to render SVG elements, with D3 v5’s `scaleBand` and `scaleLinear` mapping country names and population counts to screen coordinates. Margins are applied via a translated `<g>` group, and custom gridlines and tick labels are generated using `xScale.ticks()` instead of D3’s axis components. Data comes from a CSV of UN population estimates loaded through `d3.csv`.

AI-generated description

Finished product of this lesson

MIT Licensed

Similar vizzes