Skip to main content
100%

Making a Bar Chart

✓ Published0🌍 Public
Cceltic660
Last edited Nov 26, 2018
Created on Nov 25, 2018

This example visualizes the 2018 population estimates of the ten most populous countries as horizontal bars. The chart uses D3 version 5.6, with an SVG canvas. The code employs D3's `scaleBand` and `scaleLinear` to map country names and population counts to y- and x-coordinates, respectively, while `axisLeft` renders the y-axis labels. Data is loaded asynchronously from a CSV file via `csv()` and parsed into numbers, with each bar’s length encoding the population value.

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