Skip to main content
Public

Share visualization

Loading preview…

The Margin Convention - Bar Charts

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportHTML, source ZIP

The Margin Convention - Bar Charts

0 stars1Public
CChris Briggs
Last edited Nov 16, 2021
Created on Nov 16, 2021

This example demonstrates the margin convention for bar charts by rendering the top 10 most populous countries in 2020 using React and D3. It loads CSV data from the UN Population dataset via `d3.csv`, then uses `scaleBand` and `scaleLinear` to map countries and population values to SVG rectangles within a translated group element. The visualization appears as a horizontal bar chart with axes implied by the scales, while the margin object defines the inner plotting area. React hooks manage asynchronous data loading and state updates.

AI-generated description

A program that loads in some data using D3 utilities, arc and pie and uses React to render the data as a radial burst. Data source: MDN Named Colors

Comments

Sign in to join the discussion.

MIT Licensed