Skip to main content
100%

responsive Viz Container

✓ Published1🌍 Public
DDonald Bagwell
Last edited May 5, 2024
Created on Apr 8, 2024

This example demonstrates a responsive D3.js visualization that adapts its SVG canvas dimensions to fit its container. The code uses a `ResizeObserver` to monitor the container’s size and update the state with new width and height values, triggering a re-render. A gray inner rectangle, positioned with configurable margins, fills the available space. The example uses the `select` and `join` methods from D3 to manage the SVG elements, and is designed as a base template for creative modifications like holiday-themed variations.

AI-generated description

Creating circles with D3.

Challenge

  • Fork this example
  • Modify it
  • Maybe make it Halloween themed
  • Maybe make it Christmas themed
  • Be creative
MIT Licensed

Similar vizzes