{"version":"1.0","type":"rich","title":"color and size legends","description":"This example demonstrates reusable D3.js legend components for mapping ordinal color scales and continuous size scales. The color legend displays four fruit categories using `d3.scaleOrdinal`, while the size legend uses `d3.scaleSqrt` to visualize values from 0 to 10 with proportional circle radii. Both legends render as SVG groups with circles and text labels, using a data-join pattern for enter/update/exit transitions. The `colorLegend` and `sizeLegend` functions illustrate how to build modular, configurable legend components for scatterplots or choropleth maps.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/58b19237970149c0a30a7f9cc17fb01c?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}