Skip to main content
100%

D3 Vanilla Js - Bar Chart

✓ Published2🌍 Public
IIchi Rarámuri
Last edited Mar 15, 2020
Created on Mar 13, 2020

This example shows a horizontal bar chart of country populations using a vanilla D3 v5 setup with SVG rendering. It maps population values to bar widths via `scaleLinear`, country names to vertical positions via `scaleBand`, and renders axes with `axisLeft` and `axisBottom`. Data is loaded from a CSV file and parsed in `index.js`, with bars drawn as SVG `<rect>` elements. The code imports specific D3 modules (`select`, `csv`, `scaleLinear`, `max`, `scaleBand`, `axisLeft`, `axisBottom`) and applies a margin-based layout.

AI-generated description
MIT Licensed

Similar vizzes