🌍 Public
Viewing a saved revision (read-only)
89bf09834bab438ca5ba5743d7c19cd6
Making a bar chart
This example shows a horizontal bar chart of country populations using a bar for each nation, drawn as SVG rectangles scaled by population value. The code loads data from a CSV file and uses D3 v6 modules including `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to construct the scales and axes. Bars are appended via a data join, with population values parsed and multiplied by 1000, and the chart is rendered with margins and a steelblue fill.
AI-generated description