Skip to main content
100%

Bar Chart!

✓ Published1🌍 Public
Mmeihaoming
Last edited Nov 14, 2019
Created on Oct 18, 2019

This example shows a horizontal bar chart comparing the populations of ten countries, drawn as SVG rectangles scaled by a linear population axis. The code imports specific D3 v5 modules—`select`, `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom`—to load data from `data.csv`, transform population values by multiplying by 1000, and render axes and bars. Margins define an inner plotting area, and the bar heights come from the band scale’s bandwidth.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

MIT Licensed

Similar vizzes