The Margin Convention
✓ Published1🌍 Public
This example demonstrates the D3 margin convention by rendering a horizontal bar chart of the top ten countries by 2020 population, loaded from a CSV file. The visualization separates the chart’s inner plotting area from its outer SVG bounds using a margin object, with a scaleBand for countries and a scaleLinear for population values. Built with React and D3 v7, the SVG rectangles are positioned via a translated group element, while the data is fetched asynchronously using d3.csv.
AI-generated descriptionMIT Licensed