Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Making A Bar Chart

Public visualization

Viewing a saved revision (read-only)

0e1770cdf74149dc96e72e552835557e

Fork of Making A Bar Chart

0 stars0🌍 Public
AAlex Quan
Last edited May 12, 2023
Created on May 12, 2023
Forked from Making A Bar Chart

This example shows a horizontal bar chart of the ten most populous countries using population data from a local CSV file. The visualization renders as an SVG, with each country represented by a steel-blue bar sorted by default in data order (China through Mexico). The code imports D3 v7 modules including `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to load the data, map population values to pixel widths, position country labels on the y-axis, and display numeric population on the x-axis. The chart applies margins and appends axes and rectangles to a single `<g>` group element.

AI-generated description