Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a bar chart with D3.js

Public visualization

Viewing a saved revision (read-only)

f797c2f6334243ceb935051f1e369a10

Making a bar chart with D3.js

0 stars2🌍 Public
Ddavidpiber
Last edited Nov 18, 2019
Created on Nov 17, 2019

This example displays a horizontal bar chart of population counts for ten countries, using data loaded from a CSV file. The chart maps population values to bar widths with `d3.scaleLinear` and country names to vertical positions with `d3.scaleBand`, rendering axes via `d3.axisLeft` and `d3.axisBottom`. Bars are drawn as SVG rectangles with a steelblue fill, and the population values are multiplied by 1000 during data parsing. The visualization is built entirely with D3.js v5, using its `select`, `csv`, and scale APIs.

AI-generated description