🌍 Public
Viewing a saved revision (read-only)
9b094e02024d4f9bb035903f435a48d6
Making a bar chart
This example shows a horizontal bar chart of country populations, with bars sorted by population and labeled on the y-axis. It uses D3 v5 methods such as `scaleBand` for the categorical axis, `scaleLinear` for the numeric population scale, and the `axisLeft` and `axisBottom` functions to generate the axes. The chart is rendered as SVG, with each bar’s height set by `yScale.bandwidth()` and its width proportional to population, as read from a CSV file and scaled by a factor of 1,000.
AI-generated description