{"version":"1.0","type":"rich","title":"Color and Size Legends","description":"This example demonstrates how to create categorical color legends and quantitative size legends using D3.js v5’s `scaleOrdinal` and `scaleSqrt` APIs. The color legend maps fruit names to distinct hues, while the size legend encodes numeric values through circle radii using a square root transformation, with tick marks generated from the scale’s `ticks` method. Both legends are rendered as SVG groups containing circles and text, using the nested general update pattern to handle enter/update/exit transitions efficiently.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/1f69d0e6f000425eb6824542960f2c49?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}