The Margin Convention
✓ Published1🌍 Public
Ssophburke
Last edited Sep 20, 2019
Created on Sep 16, 2019
Forked from Making a Bar Chart with React & D3 - no Axes
This example demonstrates the margin convention in D3, rendering a horizontal bar chart of the ten most populous countries using UN World Population Prospects 2019 data. The SVG visualization maps each country’s 2020 population to a bar width via `d3.scaleLinear` and uses `d3.scaleBand` for the categorical y-axis, with bars grouped inside a translated `<g>` element that respects the specified margin. The React component asynchronously loads CSV data with `d3.csv`, and the chart updates only after the data is fetched, displaying a loading message beforehand.
AI-generated descriptionA program that makes a bar chart using data data from the [UN World Population Prospects 2019] (https://population.un.org/wpp/Download/Standard/Population/) with axes.
MIT Licensed