🌍 Public
Viewing a saved revision (read-only)
44fc8b84fe2c40d89978743a4ebf820a
Making a Bar Chark
This example shows a horizontal bar chart of country populations using D3.js v5. The SVG canvas displays bars whose lengths correspond to each nation’s population value from a CSV file, with country names listed along the vertical axis. The code uses `d3.csv`, `d3.scalelinear`, `d3.scaleBand`, and `d3.max` to map data to coordinates, appending `rect` elements to the SVG. Populations are parsed as numbers before rendering, and the chart loads asynchronously via the `csv` function.
AI-generated description