{"version":"1.0","type":"rich","title":"Margin Convention","description":"This example demonstrates the margin convention for chart layout in D3, rendering a horizontal bar chart of the top ten countries by 2020 population from a UN dataset. The chart uses React hooks to load CSV data via `d3.csv` and calculates inner dimensions by subtracting a fixed margin from the SVG’s width and height. Bars are drawn as SVG `<rect>` elements positioned with `d3.scaleBand` for the y-axis and `d3.scaleLinear` for the x-axis, all translated inside a `<g>` group using the margin offsets. The code imports `arc`, `pie`, and `max` from D3, though the example only uses the latter for scaling.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/29c677d37c71440ca83e861884e42ff1?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}