Skip to main content
100%

Making a Bar Chart

✓ Published0🌍 Public
Wwukangqian
Last edited Sep 9, 2020
Created on Sep 9, 2020

This example shows a horizontal bar chart of the top 10 most populous countries, with population values along the x-axis and country names along the y-axis. Using D3 v5, it loads data from an external CSV file and renders SVG rectangles via `selectAll('rect').data(data).enter()`. The scales are built with `scaleLinear` and `scaleBand`, while axes are generated with `axisLeft` and `axisBottom`. Population numbers are formatted using `format('.3s')` with “B” replacing “G” for billions.

AI-generated description
MIT Licensed

Similar vizzes