Skip to main content
100%

Making a bar chart

✓ Published0🌍 Public
IIsabel
Last edited Oct 1, 2018
Created on Sep 27, 2018

This example shows a horizontal bar chart ranking the ten most populous countries, with population values on the x-axis and country names on the y-axis. The code uses D3 v5’s `csv` loader to parse `data.csv`, then constructs the chart with `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom`. Bars are rendered as SVG `rect` elements, with dashed grid lines from a custom tick size and a formatted population axis using `format('.3s')`. Styling is applied via external CSS.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a bar chart.

MIT Licensed

Similar vizzes