Skip to main content
100%

The margin convention

✓ Published1🌍 Public
OOlof Ollerstam
Last edited Apr 22, 2021
Created on Apr 22, 2021

This example demonstrates the margin convention in D3 by rendering a horizontal bar chart of the ten most populous countries in 2020, using data from the UN Population dataset. The chart scales country names with `d3.scaleBand` and population values with `d3.scaleLinear`, then draws SVG rectangles inside a translated group element. The code loads the CSV via `d3.csv`, manages state with React hooks, and renders the visualization with React DOM, enforcing consistent margins around the plotting area.

AI-generated description

A program that loads in some data about CSS named color data using D3 utilities, and uses React to render the data as a radial burst!

MIT Licensed

Similar vizzes