dv.22.1 - the margin convention
✓ Published1🌍 Public
This example shows a horizontal bar chart of the top 20 most populous countries, with only rectangular bars and no axes or labels. The chart uses the margin convention by defining a margin object and translating an inner `<g>` element by those offsets, leaving space around the plot area. React state stores the CSV data from the United Nations World Population Prospects 2019, loaded via `d3.csv` with a row function that parses the '2020' population field. Bars are rendered as SVG `<rect>` elements sized using `d3.scaleBand` for the y-axis and `d3.scaleLinear` for the x-axis.
AI-generated descriptionA program that shows the top 20 most populous countries as a pathetic bar chart with no axes.
MIT Licensed