The Margin Convention
✓ Published1🌍 Public
SSerind Joshua McCue
Last edited Aug 20, 2022
Created on Aug 20, 2022
Forked from Loading Data with React & D3 - UN population
This example demonstrates the margin convention in D3.js by rendering a horizontal bar chart of the top 10 countries by 2020 population from a UN dataset. The visualization uses SVG within a React component, with `d3.scaleBand` and `d3.scaleLinear` mapping country names to y-positions and population values to bar widths. A margin object reserves space around the chart, and the chart group is translated accordingly to align the bars within the inner plotting area.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.
MIT Licensed