Skip to main content
100%

Viz Function concept

✓ Published0🌍 Public
SSubhendu Karmakar
Last edited Jan 31, 2024
Created on Jan 31, 2024
Forked from Margins

This example demonstrates the fundamental concept of margins in data visualization by drawing a gray rectangle that sits inside a larger white canvas, with padding on all four sides. The code uses D3.js (version 7.8.5) and its `select` API to create an SVG element, then renders the rectangle with computed dimensions based on the container’s client width and height minus fixed top, left, bottom, and right margins. The inner rectangle’s size is calculated from those margin values, and a fill color of `#808080` distinguishes it from the surrounding space.

AI-generated description

D3 Margins

MIT Licensed

Similar vizzes