Skip to main content
100%

Making a bar graph

✓ Published1🌍 Public
LLonwabo11
Last edited May 6, 2019
Created on May 6, 2019
Forked from Scatter plot

This example shows a horizontal bar chart of population data for nine countries, with each bar’s length proportional to the population value loaded from a CSV file. It demonstrates basic D3.js DOM manipulation by building the chart entirely with SVG elements, using `d3.scaleLinear` for the x-axis, `d3.scaleBand` for the y-axis categories, and `d3.axisLeft` and `d3.axisBottom` to render the axes. The code appends rectangles for bars and positions them via the scales, with margins applied to the SVG canvas.

AI-generated description

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

MIT Licensed

Similar vizzes