Skip to main content
100%

Making a Bar Chart

✓ Published2🌍 Public
SSagar Malviya
Last edited Jun 1, 2019
Created on Jun 1, 2019

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 description

This 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

Similar vizzes