Skip to main content
100%

Let's make a bar chart

✓ Published0🌍 Public
Yyanlibo2021
Last edited May 9, 2020
Created on May 9, 2020
Forked from Customizing Axes

This example shows a static bar chart of population data for ten countries, using SVG rectangles colored in steel blue. The visualization initially draws each bar with a fixed width of 300 pixels and a fixed height of 400 pixels, meaning the bars do not yet encode the population values visually. The code loads data from a CSV file using d3.csv, converts population strings to numbers with a unary plus operator and a multiplication factor of 1000, and then appends rectangles via d3’s data join and selection APIs. It also defines a d3.scaleLinear for the x-axis, though the scale is not yet applied to the rect dimensions.

AI-generated description
MIT Licensed

Similar vizzes