Skip to main content
100%

Jared's Responsive Margin Convention

✓ Published0🌍 Public
JJared
Last edited Sep 20, 2023
Created on Sep 19, 2023

This example demonstrates a responsive design pattern where a full-viewport SVG resizes a rounded rectangle to fit the browser window, recalculating on every resize event. It showcases a reusable margin convention function that creates an inner group element translated by specified margins, returning the group and computed inner dimensions. The code uses D3 v5 selection methods like `selectAll`, `enter`, `merge`, and `attr`, along with a custom `myResponsiveComponent` function that binds to the body element and listens for window resizing.

AI-generated description

Jumping off point for creating your own responsive visualizations with margins.

Contains a reusable implementation of the D3.js Margin Convention.

MIT Licensed

Similar vizzes