Making a Bar Chart
✓ Published0🌍 Public
This example displays the top 10 most populous countries from 2018 United Nations estimates as a horizontal bar chart. It customizes both axes, removing the y-axis domain and tick lines and formatting x-axis labels with d3.format to abbreviate population values, replacing “G” with “B” for billions. The chart uses d3.scaleLinear and d3.scaleBand to map populations and country names, with data loaded from a CSV file via d3.csv. The SVG is rendered using D3 v5, with steelblue bars and a titled, labeled layout.
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. It also demonstrates customization of D3 axes.
MIT Licensed