The Margin Convention - Continuation of Making a Bar Chart with React & D3
✓ Published1🌍 Public
PPhronesis
Last edited Nov 16, 2021
Created on Nov 16, 2021
Forked from Fork of Making a Bar Chart with React & D3
This example demonstrates the margin convention for a horizontal bar chart, displaying the top 10 most populous countries from a 2019 UN population dataset. The visualization uses React components to manage state and render SVG elements, while d3.scaleBand and d3.scaleLinear map country names to bar positions and population values to bar widths. The code leverages d3.csv for data loading, applies a consistent margin around the plotting area, and assigns random, non-repeating colors to each bar through a custom selectColor utility.
AI-generated descriptionUsing React & D3 to render a bar chart of UN population data.
MIT Licensed