🌍 Public
Viewing a saved revision (read-only)
5547ed933be64740a3dd85631cb2a122
Making a bar chart
This example demonstrates how to build a bar chart from a CSV file containing population data for ten countries. The chart maps countries to the x-axis using a band scale and populations to the y-axis with a linear scale, rendering each bar as an SVG rectangle. The code imports specific D3 v5 functions—`select`, `csv`, `scaleLinear`, `max`, and `scaleBand`—to parse the data, calculate scales, and append the elements to an SVG canvas.
AI-generated description