{"version":"1.0","type":"rich","title":"Color and Size Legends - Component Experiment","description":"This example demonstrates two custom legend components—one for a categorical color scale and one for a quantitative size scale—rendered as SVG within a D3 v5 visualization. The color legend uses `scaleOrdinal` to map fruit names to colors, while the size legend uses `scaleSqrt` to map numeric values to circle radii. Both legends are implemented as reusable functions that receive their parameters via `Object.assign`, following the \"Towards Reusable Charts\" pattern. The code explicitly sets properties on the component functions before invoking them with `.call()`, and each legend updates its groups, circles, and text elements through D3's select, enter, merge, and exit operations.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/b16f9fc3efa640789b4b28792d30515f?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}