🌍 Public
Viewing a saved revision (read-only)
567b5d4e3d8d480b80ce7afcf41442f7
Making a Bar Chart - 072019
A horizontal bar chart displays population figures for ten countries, with bars sorted alphabetically by country name along the y-axis. The chart uses D3 v5’s `scaleLinear` for the x-axis population scale, `scaleBand` for categorical y-axis positioning, and `axisLeft`/`axisBottom` to render tick marks. Population values from a CSV file are multiplied by 1000 before being passed to the render function. SVG rectangles are appended and sized via `xScale` and `yScale.bandwidth`, with the chart’s main group translated by specified margins.
AI-generated description