🌍 Public
Margin Convention
This example demonstrates the margin convention for bar charts by displaying the top 10 countries by population in 2020. The chart uses React to render SVG rectangles, with D3’s `scaleBand` for the y-axis countries and `scaleLinear` for the x-axis population values. Data is loaded via `d3.csv` from a UN population dataset. A `<g>` element applies the margin translation, showing how inner dimensions are computed from the SVG width, height, and margin object.
AI-generated descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data.
MIT Licensed
Comments
Sign in to join the discussion.