Making a bar chart
✓ Published1🌍 Public
This example shows a horizontal bar chart of population by country, using SVG rectangles to encode values. The chart arranges countries along a band scale (d3.scaleBand) and maps populations to a linear scale (d3.scaleLinear), with axes generated via d3.axisLeft and d3.axisBottom. Data is loaded from a CSV using d3.csv, and the code explicitly sets dimensions and margins. The visualization demonstrates reusable D3 v5 API patterns such as select, max, and scaleBand’s padding, with styling applied through CSS.
AI-generated descriptionAn example including some commonly used features of SVG.
MIT Licensed