Skip to main content
100%

Making a bar chart with D3.js!

✓ Published1🌍 Public
CCalvin Gomez
Last edited May 14, 2020
Created on May 11, 2020

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 description
MIT Licensed

Similar vizzes