Skip to main content
100%

Making a Bar Chart

✓ Published2🌍 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
MIT Licensed

Similar vizzes