Making a Bar Chart
✓ Published0🌍 Public
This example shows the population of the top 10 most populous countries in 2018, based on United Nations data loaded from a CSV file. A bar chart renders the values using D3 v5’s `scaleLinear` for the x-axis, `scaleBand` for the y-axis, and `axisLeft`/`axisBottom` for the axes. The SVG bars are appended via `selectAll` and `data`, with the population values scaled by a factor of 1,000. The chart is styled with steel-blue rectangles and is rendered entirely in SVG.
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.
MIT Licensed