🌍 Public
Viewing a saved revision (read-only)
2a5230b8ed5a40c18aaf7dcc02d156a0
Making a Barchart
This example shows a horizontal bar chart comparing the populations of ten countries, from China to Mexico. The chart uses D3 v5 APIs including `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to load the data, map values to positions, and render axes. Bars are drawn as SVG `rect` elements with a steelblue fill, and population values are multiplied by 1000 in the data-loading step before the visualization is rendered. The layout applies margins and transforms the main group to position the chart within the SVG canvas.
AI-generated description