Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

The margin convention

Public visualization

Viewing a saved revision (read-only)

a310d552e3124aa38aadaf941b47d433

The margin convention

0 stars1🌍 Public
FFulvio Vigilante
Last edited Jul 15, 2021
Created on Jul 15, 2021

This example demonstrates a bar chart of the top ten countries by 2020 population, highlighting the margin convention by grouping all marks within a translated `<g>` element. The code uses React hooks (`useState`, `useEffect`) to load and parse CSV data via `d3.csv`, then applies `scaleBand` and `scaleLinear` to position rectangles. The SVG rendering relies on `d3.max` for domain scaling, while the inner dimensions are calculated from predefined margins, ensuring consistent spacing around the plot area.

AI-generated description