{"version":"1.0","type":"rich","title":"Color and Size Legends","description":"This example demonstrates how color and size legends can be created using D3.js v6, displaying three categorical items (apple, lemon, lime) mapped to distinct colors. It shows two legends: one for color encoding using a categorical color scale and another for size representation through circle radius. The implementation uses a custom `colorLegend` function that leverages D3's selection API with `selectAll`, `enter`, `merge`, and `exit` patterns to manage SVG groups of circles and text labels. The legend items are vertically spaced and annotated with text labels, with the entire SVG rendered using vector graphics.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/f5c78a109bca45778016470034312828?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}