Skip to main content
100%

The Margin Convention

✓ Published1🌍 Public
DDusty
Last edited Aug 16, 2021
Created on Aug 16, 2021

This example displays a horizontal bar chart of the top 10 most populous countries in 2020, drawing from UN population data loaded via D3’s `csv` utility. React renders an SVG with scaled rectangles, using `scaleBand` for country categories and `scaleLinear` for population values, all positioned within a fixed margin using the `transform` attribute. The code relies on D3 v5 and React’s `useEffect` and `useState` hooks, with the chart’s dimensions computed from explicit top, right, bottom, and left margins to define the inner plotting area.

AI-generated description

A program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data as a radial burst!

MIT Licensed

Similar vizzes