Skip to main content
100%

The Margin Convention

✓ Published1🌍 Public
MMosheAron
Last edited Mar 4, 2021
Created on Mar 4, 2021
Forked from Pathetic Bar Chart

This example shows a horizontal bar chart of the top ten countries by 2020 population, with the bars drawn inside a translated SVG group to demonstrate the margin convention. The chart uses React state to manage the loaded data and conditional rendering to display a loading message. D3 utilities load the CSV data from a GitHub gist, while `scaleBand` and `scaleLinear` position the bars and map population values to widths. The outer SVG measures 960 by 500 pixels, with a 50-pixel margin on each side that defines the inner chart area.

AI-generated description

A program that loads in some data about CSS naned colors using D3 utilities, and uses React state to render of the data as a Pathetic Bar Chart.

MIT Licensed

Similar vizzes