Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Margin convention

Public visualization

Margin convention

0 stars1🌍 Public
BBurak Senel
Last edited Mar 16, 2021
Created on Mar 16, 2021

This example demonstrates the margin convention in D3 by rendering a horizontal bar chart of UN population data for ten countries. The SVG output positions a grouped `<g>` element with margins applied via a `transform` attribute, while `scaleBand` and `scaleLinear` map country names and population values to the inner chart dimensions. The React component manages asynchronous CSV loading with `useState` and `useEffect`, and the code explicitly imports `csv`, `scaleBand`, `scaleLinear`, and `max` from the D3 v6 bundle.

AI-generated description

A program to load CSV data

Comments

Sign in to join the discussion.

MIT Licensed