Making a Bar Chart
✓ Published0🌍 Public
This example displays the top 10 most populous countries as horizontal bars, using data from the United Nations World Population Prospects 2019. The chart ranks countries from China to Mexico on a linear population scale, with a band scale for country labels and a grid of horizontal tick lines. Built with D3 v5, it uses `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to render SVG rectangles, while formatting population values with `format`. The axis labels and title are styled via external CSS.
AI-generated descriptionA program that shows the top 10 most populous countries as a bar chart.
MIT Licensed