{"version":"1.0","type":"rich","title":"MasteringD3js_ReuseProD3_Ch2 pt1","description":"This example demonstrates how to build reusable chart components in D3.js v5 by wrapping SVG creation logic in a function that can be called on a selection, following the pattern from Pro D3.js. The page shows two containers where an array of three string values is bound to div elements, then each div uses `selection.call()` with a custom `chart2` function to append an SVG element with a white background rectangle. The code highlights the transition from earlier D3 versions, using `data()`, `enter()`, and `append()` to manage the enter selection, with the second example adding nested divs and SVG elements.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/c10fe30c4801471891a5d0a601023795?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}