Making a bar chart
✓ Published2🌍 Public
This example shows a horizontal bar chart comparing the populations of ten countries, sorted by the country name. It uses D3 v6 to load a CSV file and render SVG rectangles. The code defines linear and band scales with `scaleLinear` and `scaleBand`, and draws the y-axis using `axisLeft`. Rectangles are appended via the enter selection, with widths mapped to population values and heights set by the band's bandwidth.
AI-generated descriptionMIT Licensed