{"version":"1.0","type":"rich","title":"Color Legend","description":"This example demonstrates how to create color and size legends in D3 v5 using reusable functions. It shows ordinal color scaling mapping fruit names to pastel colors, and a square-root size scale with transitioning circles. The SVG rendering includes animated transitions on the size legend, while text labels accompany each legend entry. The code uses `d3.scaleOrdinal`, `d3.scaleSqrt`, and D3's selection join pattern with `.enter()` and `.merge()`.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/6f0cfcf2e93249fbb2deb73b25f5d8c6?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}