Skip to main content
100%

Dataviz 6 - Margin convention

✓ Published1🌍 Public
RRyAlpha
Last edited Nov 24, 2021
Created on Nov 24, 2021

This example displays the top 10 most populous countries from the United Nations World Population Prospects 2019 dataset as simple bars without axes or labels. It demonstrates the margin convention by using D3’s scaleBand and scaleLinear to map country names and population values to pixel ranges within an inner chart area. The React component loads CSV data via useCallback and useEffect, then renders SVG rectangles inside a translated group element. The code uses d3.csv, scaleBand, scaleLinear, and max from d3.v5.

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