Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a bar chart

Public visualization

Making a bar chart

0 stars0🌍 Public
Jjwadh
Last edited Feb 21, 2022
Created on Feb 20, 2022

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

Comments

Sign in to join the discussion.

MIT Licensed