Skip to main content
100%

Making a barchart

✓ Published0🌍 Public
SSimonPlanje
Last edited Nov 3, 2020
Created on Nov 3, 2020

This example shows a horizontal bar chart of country populations, using D3 v6 to load data from a CSV file and render it as SVG rectangles. The visualization orders countries by descending population, with bar lengths scaled linearly and categorical spacing handled by `d3.scaleBand`. The code uses `d3.csv` to parse the data, `d3.scaleLinear` for the x-axis, `d3.axisLeft` and `d3.axisBottom` for labeled axes, and appends styled `<rect>` elements to the SVG.

AI-generated description
MIT Licensed

Similar vizzes