Viewing a saved revision (read-only)
c3fe85e2d5e945baa60c21e633e0c47f
Making a bar chart in D3.js
This bar chart displays the population of the top 10 most populous countries, using 2018 estimates from the UN World Population Prospects. The chart renders as SVG with a light blue background, showing each country on the y-axis and its population on the x-axis. The code uses D3 v7 modules including `select`, `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to load the data, scale the values, and draw the axes. Bars are appended as rectangles with steelblue fills, and population values are multiplied by 1000 from the CSV source.
AI-generated descriptionThis bar chart shows population of the top 10 most populous countries. The data comes from the year 2018 estimate in World Population Propsects 2017.