Making a Bar Chart
✓ Published0🌍 Public
This example shows the population of the ten most populous countries in 2018, based on United Nations estimates. It uses d3.csv to load the data, d3.scaleLinear for the horizontal axis, and d3.scaleBand for vertical country categories. The bars are rendered as SVG rectangles, with d3.axisLeft and d3.axisBottom creating the axes. Population values are multiplied by 1,000 before being drawn, and the chart is laid out with fixed margins inside a 960-by-500 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