Making a Bar Chart
✓ Published1🌍 Public
This example shows a horizontal bar chart of population by country, using a CSV dataset ordered from China to Mexico. D3 v5 functions `csv`, `scaleLinear`, and `scaleBand` map population values to bar widths and country names to row heights, while `axisLeft` and `axisBottom` render the axes. The SVG renders steel-blue rectangles with D3’s `selectAll` and data joins, with a fixed 960×500 viewport and margins defining the inner plot area.
AI-generated descriptionMIT Licensed