🌍 Public
Viewing a saved revision (read-only)
9f07435ff85848609494cb9fce373702
The margin convention
This example demonstrates D3’s margin convention by rendering a horizontal bar chart of UN population data for the top ten countries in 2020. The chart uses React state to load the CSV via `d3.csv` and maps each country to a `<rect>` inside a translated `<g>` element, with scales from `d3.scaleBand` and `d3.scaleLinear`. All marks are drawn as SVG within a fixed 960×500 viewport, clearly separating the plotting area from the surrounding margins.
AI-generated descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React state to render the data.