Skip to main content
Public

Share visualization

Loading preview…

Fork

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Fork

0
SSivasakthi C
Last edited Aug 12, 2024
Created on Aug 12, 2024

This example demonstrates a responsive SVG visualization where a gray rectangle remains centered within the container as its dimensions adjust dynamically. The code uses a `ResizeObserver` to continuously update the width and height in the component state, and D3’s `select` and `join` methods to efficiently render the SVG and rectangle. The inner rectangle's size is calculated from the container's current dimensions minus fixed margins, ensuring it always fits within the available space.

AI-generated description

A responsive visualization container that uses ResizeObserver.

Challenge

  • Make one of your visualizations responsive using this pattern

Comments

Sign in to join the discussion.

MIT Licensed