Skip to main content
100%

Making a Bar Chart

✓ Published0🌍 Public
BBraja Gopal Das
Last edited Apr 9, 2019
Created on Apr 9, 2019

This example shows a horizontal bar chart of country populations, with bars scaled to population size and country names on the y-axis. Using d3.csv to load data.csv, it parses population values as numbers, then applies d3.scaleLinear and d3.scaleBand for positioning. The chart renders in SVG, with d3.axisLeft and d3.axisBottom generating labeled axes and tick formatting via d3.format('.3s') for compact labels. Rect elements are appended and sized using the scales, with steelblue fill from CSS.

AI-generated description

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

MIT Licensed

Similar vizzes