🌍 Public
Viewing a saved revision (read-only)
6c12ce55846e4eaab953e4702c81922e
Fork of Fork of Responding to Resize
This example demonstrates a simple responsive chart that dynamically adjusts an SVG to fill the browser viewport. It first extracts the client width and height from its container, then sets the SVG’s `width` and `height` attributes accordingly, and redraws two green diagonal lines to verify the resizing behavior. The visualization uses D3.js v5 to create and update the SVG elements, leveraging a listener for the window’s `resize` event to trigger the redraw. The code relies on the `d3.select` API to bind the chart container and `attr` to update the SVG dimensions.
AI-generated description