Skip to main content
100%

Making a Bar Chart!

✓ Published1🌍 Public
IIgor Borzunov
Last edited Aug 17, 2020
Created on Aug 17, 2020

This example demonstrates a bar chart of the world’s most populous countries, using data from a local CSV file. The chart uses D3 v5’s `scaleLinear` and `scaleBand` to map population counts and country names to the SVG canvas. Rectangles are drawn and filled pink via CSS, with axes generated by `axisBottom` and `axisLeft`. The x-axis labels are formatted using D3’s `format` function, converting values to abbreviated numbers like "1.42B". Clicking a bar logs the corresponding SVG element to the console.

AI-generated description
MIT Licensed

Similar vizzes