Making a Bar Chart
This example visualizes the population of the top 10 most populous countries using a horizontal bar chart, with data sourced from the 2018 United Nations World Population Prospects. The population values are displayed along the x-axis while country names are mapped to the y-axis using band scaling. The visualization uses d3.scaleLinear for the numeric axis, d3.scaleBand for categorical positioning, and d3.axisLeft and d3.axisBottom to render the chart’s axes. Rectangles represent each country’s population, and the SVG rendering is powered by D3 v3 and v7 modules, with CSS styling applied to the bars.
AI-generated descriptionThis bar chart shows population of the top 10 most populus countries. The data comes from the year 2018 estimate in United Nations: World Population Prospect 2017.