🌍 Public
Viewing a saved revision (read-only)
811f7e021bc44a00b14854f37624019e
The Margin Convention
This example demonstrates the margin convention in data visualization by rendering a bar chart of population data for the top 10 countries from a UN Population 2019 CSV file. The chart uses D3 v7’s `scaleBand` for the categorical y-axis and `scaleLinear` for the continuous x-axis, with React state managing the asynchronous data loading via `d3.csv`. The SVG is sized to the window, and the chart is translated by fixed margin values, showing how inner plotting area dimensions are calculated from the total width and height minus margins.
AI-generated descriptionA program that loads in some data using D3 utilities, and uses REACT state to keep track of the data.