Skip to main content
100%

The Margin Convention

✓ Published1🌍 Public
Qqtrfx
Last edited Jun 17, 2023
Created on Jun 17, 2023

This example demonstrates the margin convention for bar charts, showing the top 10 countries by 2020 population from a UN dataset. The code loads CSV data with `d3.csv`, processes it using a row conversion function, and renders SVG rectangles via React. It uses `d3.scaleBand` for the categorical y-axis, `d3.scaleLinear` for the quantitative x-axis, and `d3.max` to compute the domain. A `<g>` element translates the chart by the specified margin, with the inner width and height calculated by subtracting margins from the full dimensions.

AI-generated description

A program that loads in some data using D3 utilities, and uses React to render the Data.

MIT Licensed

Similar vizzes