Skip to main content
100%

d3 margin thingy

✓ Published0🌍 Public
Aallyraza
Last edited Nov 22, 2017
Created on Nov 22, 2017

This example demonstrates the distinction between margin and padding in a D3.js chart layout. Two nested rectangles with gray and white fills show the outer margin area and inner padding region, while axes are positioned at the edges of the inner content. The code uses D3 v4 with `d3.scaleLinear`, `d3.axisLeft`, and `d3.axisBottom` within an SVG, calculating dimensions by subtracting `margin` and `padding` objects from fixed outer width and height values. A text label annotates the spacing values.

AI-generated description

Built with blockbuilder.org

forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/0164039dc94ba96b6b16c0d9cf3ff1d2'>d3 margin thingy</a>

mit Licensed

Similar vizzes