Making a bar chart
✓ Published0🌍 Public
This example shows a horizontal bar chart of population by country, ranking the ten most populous nations from China to Mexico. It uses d3.csv to load the data, d3.scaleLinear for the x-axis population scale, and d3.scaleBand for the categorical y-axis. The chart renders as SVG rectangles with steelblue fill, with d3.axisLeft and d3.axisBottom providing labeled scales. Margins and a group transform position the plot, while the population values are multiplied by 1000 to reflect full counts.
AI-generated descriptionMIT Licensed