Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

The Margin Convention

Public visualization

Viewing a saved revision (read-only)

44461c3f0d8e42e7a1b5a2e1f9e09a33

The Margin Convention

0 stars1🌍 Public
Jjiro2017
Last edited Sep 20, 2021
Created on Sep 19, 2021

This example demonstrates the “margin convention” for D3 visualizations by rendering a horizontal bar chart of population data for ten countries in 2020. A React component uses the `useState` and `useEffect` hooks to load CSV data via `d3.csv`, then computes scales with `scaleBand` and `scaleLinear`. The SVG output positions all bars within a translated `<g>` element based on specified margin values, with `d3.max` determining the x-domain. The chart updates from a loading state to display the final encoded bars.

AI-generated description

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