🌍 Public
Viewing a saved revision (read-only)
0348788728a24f47aff8f48160e56194
The Margin Convention
This example demonstrates a simple horizontal bar chart of the top ten countries by 2020 population, using data loaded from a CSV file. The chart applies the margin convention, reserving space around the plot area with a 20-pixel margin on all sides. The visualization uses React state to manage the data and renders SVG rectangles, with scales defined by `d3.scaleBand` for the y-axis and `d3.scaleLinear` for the x-axis. Population values are parsed from the CSV using D3’s `csv` utility.
AI-generated descriptionA program that loads in some data of CSS Named Colors
D3 utilities and uses React state to render the data