{"version":"1.0","type":"rich","title":"The margin convention","description":"This example demonstrates the margin convention in D3, a common pattern for reserving space around a chart’s plotting area. It renders a horizontal bar chart of the top 20 countries by 2020 population from a CSV dataset. The code uses React hooks to fetch and parse the data, then applies `d3.scaleBand` and `d3.scaleLinear` to map countries and populations to SVG rectangles. A `<g>` element is translated by the margin offsets, ensuring axes and labels fit neatly within the overall SVG canvas.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/7dcc920e8d1647cdbf78a281059c530c?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}