Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

The Margin Convention

Public visualization

Viewing a saved revision (read-only)

5b27c60482c24f80ac50ab79e69fe27b

The Margin Convention

0 stars1🌍 Public
KK3zter
Last edited Dec 17, 2021
Created on Dec 17, 2021
Forked from Simple Bar Chart

This example shows a horizontal bar chart of the top 10 countries by population in 2020, loaded from a CSV file. The chart demonstrates the margin convention by offsetting a group of rectangles using an SVG transform. React state manages the asynchronous data loading with `d3.csv`, while the scales `scaleBand` and `scaleLinear` map country names and population counts to the inner chart dimensions. The bars are rendered as SVG `rect` elements within React’s declarative JSX structure.

AI-generated description

Loads in some data using D3 and uses react state to track the data