{"version":"1.0","type":"rich","title":"d3 update() exit()","description":"This example demonstrates how D3's update and exit states work when binding data to existing DOM elements. It shows four paragraph elements for dog, cat, pig, and rat, which are then bound to a two-item dataset using `d3.select('body').selectAll('p')` and `.data(dataset)`. The update state calls `.text()` to display values, while the exit state uses `.exit()` to label elements that no longer have corresponding data, showing their index positions. The code explicitly avoids calling `.remove()` on the exiting elements, leaving them visible for inspection in the browser.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/7a6dee9c31f24fbcbad38dec0d88681a?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}