Skip to main content
๐ŸŒ Public

Share visualization

Send this visualization to others.

Margin convention

Public visualization

Margin convention

0 stars1๐ŸŒ Public
EErik
Last edited Oct 13, 2021
Created on Oct 13, 2021

This example demonstrates the D3 margin convention by rendering a simple bar chart of UN population data for 2020. A React component uses `useState` and `useEffect` to load and parse the CSV, then renders an SVG with scaled rectangles via `scaleBand` and `scaleLinear`. The chart translates a group element by the specified margins, leaving the visualization area clear of axes or labels. Only the first four countries are displayed, with bars sized proportionally to their populations.

AI-generated description

Smiley face implementation with React & D3.

Comments

Sign in to join the discussion.

MIT Licensed