Making a Bar Chart
✓ Published1🌍 Public
This example shows the top 10 countries by population in 2022 using a horizontal bar chart, with countries on the y-axis and population counts on the x-axis. The code uses d3.csv to load data from a local CSV file, d3.scaleLinear and d3.scaleBand for scaling, and d3.axisLeft and d3.axisBottom to render axes. It loads a dataset from Worldometer, parses population values as numbers, and appends SVG rectangles styled with steelblue fills to visualize the bars within a predefined margin layout.
AI-generated descriptionTop 10 Countries in the World by Population (as of 2022). Data taken from Worldometer: Population by Country (2022).
MIT Licensed