{"version":"1.0","type":"rich","title":"Color and Size Legends","description":"This example demonstrates how legends can visualize both ordinal color scales and quantitative size scales. A color legend maps fruit names to distinct hues using `d3.scaleOrdinal`, while a size legend translates a numeric range into varying circle diameters via `d3.scaleSqrt`. Both legends are constructed as reusable functions that append SVG `<g>` groups and circles, using D3’s selection and merge patterns to handle updates. Text labels accompany each circle, positioned relative to the circle’s radius.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/8f94cda872f34070ab7fc975c341aa34?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}