{"version":"1.0","type":"rich","title":"Color and Sized Legends with D3.js","description":"This example demonstrates how to build a color legend with D3.js, using a categorical scale to map named domains like “apple” and “lemon” to red and yellow circles. The code leverages `scaleOrdinal`, `selection.merge`, and custom legend functions to position groups with spacing, adding text labels offset from each circle. It renders as SVG with a static dataset defined inline, showing the legend’s interactivity through enter, update, and exit selections. The visualization also includes sample population data from a CSV file, though it is not actively displayed in the main legend.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/60a28af516bf40ab969bda3b9bf4dee8?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}