🌍 Public
Viewing a saved revision (read-only)
d6e6159ea97a438092d44bc45b45f8f4
The Margin Convention
This example shows a horizontal bar chart of the top ten most populous countries, using data from the United Nations World Population Data 2019. The chart is rendered as an SVG in a React component, with the bars sorted in descending order of population. The code builds the visualization using d3.scaleBand for the y-axis categories, d3.scaleLinear for the x-axis values, and d3.csv to load the data, positioning all elements within a defined margin using a translation transform.
AI-generated descriptionUsing United Nations World Population Data 2019 and React to render a bar chart with margins.