Skip to main content
100%

Making a Bar Chart

✓ Published1🌍 Public
RRafael Campos
Last edited Apr 22, 2020
Created on Apr 22, 2020

This example displays the top 10 most populous countries as a horizontal bar chart, using population figures from a CSV file. The bars are rendered as SVG rectangles, with a linear scale mapping population to bar width and a band scale positioning countries along the vertical axis. The code uses d3.csv, d3.scaleLinear, d3.scaleBand, d3.axisLeft, and d3.axisBottom, with a custom tick formatter that converts values from billions to a readable format. Axis labels and a chart title are added via SVG text elements.

AI-generated description
MIT Licensed

Similar vizzes