Making a Bar Chart
✓ Published2🌍 Public
This example displays the population of the top 10 most populous countries using a horizontal bar chart. It loads data from a CSV file containing 2018 United Nations population estimates, with each bar’s length scaled by population. The visualization uses D3 v5’s `scaleLinear` and `scaleBand` for positioning, along with `axisLeft` and `axisBottom` for tick marks. The code reads the CSV via `d3.csv`, converts population values to thousands, and renders SVG rectangles in a single group with margins.
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