Skip to main content
100%

Making a Bar Chart

✓ Published2🌍 Public
RRohit K Bharadwaj
Last edited Sep 21, 2019
Created on Sep 21, 2019

This example shows a horizontal bar chart of country populations, with a data file contribution in `data.csv`. `index.js` uses D3 v5’s `select`, `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to create an SVG visualization. It parses the CSV with `csv`, multiplies each population value by 1000, and then renders steelblue rectangles using the linear scale for bar widths and the band scale for row heights. Axis ticks are drawn via `axisLeft` and `axisBottom`, with a margin-based layout translating the main group into the SVG canvas.

AI-generated description
MIT Licensed

Similar vizzes