Skip to main content
100%

The Margin Convention

✓ Published1🌍 Public
JJakub
Last edited Dec 10, 2021
Created on Dec 10, 2021
Forked from Pathetic Bar Chart

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 description
MIT Licensed

Similar vizzes