Making a bar chart
✓ Published2🌍 Public
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 descriptionMIT Licensed