Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a bar chart

Public visualization

Viewing a saved revision (read-only)

fa094c0efa554fa28ce3627734a00344

Making a bar chart

0 stars1🌍 Public
Yyoghurtx
Last edited Nov 4, 2019
Created on Nov 4, 2019

This example shows a horizontal bar chart ranking countries by population, with bars ordered alphabetically along the y-axis and population values on the x-axis. It uses d3.csv to load the data, d3.scaleLinear for the x-scale, d3.scaleBand for the y-scale, and d3.axisLeft and d3.axisBottom to render the axes. The SVG rect elements are filled with steelblue, and the chart is positioned within margins. Population values are converted from thousands to raw numbers before rendering.

AI-generated description