Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Bar Chart

Public visualization

Viewing a saved revision (read-only)

e4ff6302d57d422f83ca58bbe4cda0fa

Making a Bar Chart

1 star0🌍 Public
Wwukangqian
Last edited Sep 9, 2020
Created on Sep 9, 2020

This example shows a horizontal bar chart of the top 10 most populous countries, with population values along the x-axis and country names along the y-axis. Using D3 v5, it loads data from an external CSV file and renders SVG rectangles via `selectAll('rect').data(data).enter()`. The scales are built with `scaleLinear` and `scaleBand`, while axes are generated with `axisLeft` and `axisBottom`. Population numbers are formatted using `format('.3s')` with “B” replacing “G” for billions.

AI-generated description