Making a bar chart with D3.js!
✓ Published1🌍 Public
This example shows a horizontal bar chart of country populations, using bar length to encode population size and the y-axis to list country names. The visualization renders in SVG and loads data from a CSV file, converting population values to numbers before scaling. The code builds the chart with D3 v5 functions including `csv`, `scaleLinear`, `scaleBand`, `axisBottom`, `axisLeft`, and `select`, positioning bars within a margin-based layout. Rectangles are appended via a data join, with widths mapped from the linear scale and heights from the band scale.
AI-generated descriptionMIT Licensed