{"version":"1.0","type":"rich","title":"Responding to Resize","description":"This example demonstrates how a D3.js v5 visualization can respond to browser window resizing by redrawing its content to match the computed CSS size of its container. The SVG element’s width and height are dynamically updated using `chartDiv.clientWidth` and `clientHeight`, and two diagonal lines are drawn to form an X shape as a visual confirmation of the new dimensions. The code uses D3 selections with `selectAll`, `enter`, and `merge` to update the line elements, and a `window` `resize` event listener triggers the redraw function. The container is fixed to fill the viewport via CSS.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/3ea7f1a4523f4533ba7d1fb4428723ab?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}