Skip to main content
100%

Margin convention

✓ Published1🌍 Public
MmohitPassan
Last edited Apr 26, 2021
Created on Apr 26, 2021

This example shows a horizontal bar chart of country populations derived from a CSV file of 2020 data, with bars rendered in SVG using React. The visualization demonstrates the margin convention by using a fixed outer width and height, subtracting top, right, bottom, and left margins to calculate an inner plotting area, then applying a transform to a `<g>` element. It loads the dataset with `d3.csv`, converts the population column to numbers, and scales the bars with `scaleBand` for the y-axis and `scaleLinear` for bar widths based on the maximum population.

AI-generated description

A program that loads in some data about CSS colors using d3 and keeps track using react

MIT Licensed

Similar vizzes