Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Bar Chart

Public visualization

Viewing a saved revision (read-only)

24f1a2f4fb7e4bfcb5195e55f1074e9e

Making a Bar Chart

0 stars0🌍 Public
Ttanvirmahdad
Last edited Jan 30, 2021
Created on Jan 30, 2021

This example shows a horizontal bar chart comparing the population of ten countries, from China down to Mexico, based on United Nations data. Using D3 v6, the visualization maps population values to bar widths with a linear scale and country names to vertical positions with a band scale. Axes are rendered via `d3.axisLeft` and `d3.axisBottom`, while `d3.csv` loads the dataset and `d3.max` calculates the domain. The bars are drawn as SVG rectangles with steelblue fill, and the population values are converted from thousands to raw numbers in the loading callback.

AI-generated description

Basic example of bar-chart developed from population data from United Nations