Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Let's make a bar chart with D3.js

Public visualization

Viewing a saved revision (read-only)

ad6d0c7223504c43b0244e5895d4cb02

Let's make a bar chart with D3.js

0 stars0🌍 Public
Xx1umao
Last edited Oct 18, 2020
Created on Oct 18, 2020

This example shows a bar chart of country populations using D3.js, with each bar’s height scaled linearly from the population values and positioned along a categorical axis for country names. It renders entirely as SVG, using `scaleLinear` for the y-axis, `scaleBand` for the x-axis, and `axisLeft` to draw tick marks. Population data comes from a CSV file loaded via `csv`, and the bars are appended as `rect` elements with a steelblue fill. The chart uses margins to place the plot area within a fixed 960×500 SVG canvas.

AI-generated description

A bare minimum HTML page.

See also React Starter.