Skip to main content
100%

The Margin Convention

✓ Published1🌍 Public
CCurran Kelleher
Last edited Nov 10, 2020
Created on Sep 13, 2019
Forked from Pathetic Bar Chart

This example demonstrates the margin convention, a fundamental layout principle for D3 visualizations, using React to render a bar chart of the top 10 most populous countries. The chart initially shows only bars without axes, emphasizing the importance of reserving space for chart furniture. The code uses `d3.scaleBand` and `d3.scaleLinear` to map country names and population values to screen coordinates, with data loaded from a CSV via `d3.csv`. The SVG output is positioned using a `transform` attribute that translates the inner group by the specified margins.

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