{"version":"1.0","type":"rich","title":"Color and Size Legends","description":"This example demonstrates two SVG legends for mapping data to visual channels. The color legend uses a `scaleOrdinal` with domain categories and a range of colors, while the size legend uses `scaleSqrt` with five ticks to show proportional circle radii. Both legends are implemented as reusable functions, `colorLegend` and `sizeLegend`, which bind data to groups and update circles and text elements. The code uses D3 v5 selections, `enter`/`merge`/`exit` patterns, and SVG attributes like `r`, `fill`, and `transform` for layout.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/a8661fb7f6104b148d8fc73c4d56d950?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}