Skip to main content
100%

Ep22 UN Bar Chart with Margins

✓ Published1🌍 Public
SStoo Sepp
Last edited Oct 30, 2021
Created on Oct 30, 2021

This example displays a horizontal bar chart showing the 2020 populations of the first ten countries in a UN population dataset loaded from a GitHub CSV file. It illustrates how D3's `scaleBand` and `scaleLinear` APIs position the bars, with margins set on the SVG canvas via the `margin` object and a `g` element translation. React's `useState` and `useEffect` hooks load the data asynchronously, rendering a "Loading..." message until the data arrives. The SVG rendering includes axis tick labels generated from the scales.

AI-generated description

a program that loads in data about CSS Named Colours using d3 with useState hook to update

MIT Licensed

Similar vizzes