🌍 Public
Viewing a saved revision (read-only)
76fcb98b392c426fb006e55f13e69cc4
Bar chart with margins&axes
This example visualizes the top 10 countries by 2020 population from a UN dataset as a horizontal bar chart. The React app loads CSV data with D3’s `csv` method, then uses `scaleBand` and `scaleLinear` to map countries and population values to SVG rectangles. Axes are drawn manually with `xScale.ticks()` for x-axis grid lines and labels, while y-axis country names are positioned using the band scale. The chart includes margins and a left-aligned plot area, rendered entirely as SVG.
AI-generated descriptionA program that loads some data