Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Bar Chart

Public visualization

Viewing a saved revision (read-only)

0a3fa1cbfaca4d5998a08beca3f628f5

Making a Bar Chart

0 stars1🌍 Public
陳陳泰元
Last edited Sep 30, 2022
Created on Sep 30, 2022
Forked from Make a face

This example demonstrates how to build a simple horizontal bar chart using D3 v7, displaying population data for ten countries from a CSV file. The chart shows each country’s population as a steelblue rectangle, scaled linearly along the x-axis and positioned by a band scale on the y-axis. The code uses D3 modules like `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom`, rendering SVG elements within a 960x500 viewport. Population values are converted from thousands to actual counts before being passed to the scales.

AI-generated description

A demonstration of how to start using D3 version 6.