🌍 Public
Viewing a saved revision (read-only)
7998051f9e264cb3b6169a731f3269b5
The Margin Convention
This example shows a horizontal bar chart of the top 10 countries by population in 2020, loaded from a CSV file. The chart demonstrates the margin convention by offsetting a group of rectangles using an SVG transform. React state manages the asynchronous data loading with `d3.csv`, while the scales `scaleBand` and `scaleLinear` map country names and population counts to the inner chart dimensions. The bars are rendered as SVG `rect` elements within React’s declarative JSX structure.
AI-generated descriptionLoads in some data using D3 and uses react state to track the data