Making a Bar Chart
✓ Published0🌍 Public
This example displays a horizontal bar chart ranking the top 10 most populous countries based on 2018 data from the United Nations World Population Prospects. Using D3 v5, it loads country and population values from a CSV file, applies a linear scale to the population axis and a band scale for countries, then renders steelblue rectangles as bars. The implementation imports specific D3 modules—`select`, `csv`, `scaleLinear`, `scaleBand`, and `axisLeft`—but leaves the axis-related code commented out, so only the bars appear.
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