Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Bar Chart

Public visualization

Making a Bar Chart

0 stars2🌍 Public
BBarryC7
Last edited Jan 16, 2020
Created on Oct 29, 2019

This example demonstrates a horizontal bar chart comparing the populations of ten countries, using a CSV data source. It renders as an SVG using D3 v5, loading data with `d3.csv` and scaling with `d3.scaleLinear` and `d3.scaleBand`. The chart draws axes via `d3.axisLeft` and `d3.axisBottom`, and creates steel-blue bars with an applied `d3.selection` and `.append('rect')`. The code sets the chart’s dimensions from the SVG attributes and applies margins for clear presentation.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed