{"version":"1.0","type":"rich","title":"re-render elements","description":"This example demonstrates how D3’s data join handles re-rendering when the dataset changes. It creates an SVG with five rectangles, first rendering three red rectangles from the array [1, 2, 2.5], then re-rendering with five blue rectangles from [1, 2, 3, 4, 5]. The code uses `d3.scaleLinear` to map data values to x-coordinates, and `selectAll`, `data`, `enter`, `exit`, and `merge` to update the DOM. Exiting rectangles are removed, while new ones are appended and colored according to the latest render call.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-7ee38fde0f6da0b670abcfa899567493?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}