Making a Bar Chart
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.