Making a Bar Chart
✓ Published0🌍 Public
This example displays a bar chart of the top 10 most populous countries, using 2018 population estimates from the United Nations World Population Prospects. The population values, stored in a CSV file, are multiplied by 1,000 and mapped to bar widths using `d3.scaleLinear`, while country names are positioned on a `d3.scaleBand` axis. It uses `d3.axisLeft` and `d3.axisBottom` to render axes, with tick labels formatted via `d3.format`. The chart is drawn as SVG elements, with a title and axis label added as text.
AI-generated descriptionThis bar chart shows population of the top 10 most populous countries. The data comes from the year 2018 estimate in United Nations: World Population Prospects 2017. It also demonstrates customization of D3 axes.
MIT Licensed