Skip to main content
100%

Margin Convention

✓ Published1🌍 Public
Rrstrauss127
Last edited Apr 29, 2022
Created on Apr 29, 2022

This example displays a horizontal bar chart that contrasts the populations of ten countries. The bar lengths are proportional to each country’s 2020 population, with country names listed along the vertical axis. The code uses React’s `useState` and `useEffect` to asynchronously fetch CSV data from a remote URL, then leverages D3 utilities like `scaleBand` for the categorical y-axis and `scaleLinear` for the quantitative x-axis. The SVG rendering applies a margin convention, translating a group element by the top and left margin values to position the chart within the 960x500 canvas.

AI-generated description

Radial colors!! A program that loads & renders in some [data about CSS named colors] (https://gist.github.com/curran/b236990081a24761f7000567094914e0) using D3 utilities, and uses React state to keep track of the data.

MIT Licensed

Similar vizzes