{"version":"1.0","type":"rich","title":"Colour and size legends","description":"This example demonstrates two types of legends for scatterplots: a color legend using `d3.scaleOrdinal` and a size legend with `d3.scaleSqrt`, both rendered as SVG groups with `circle` and `text` elements. The color legend maps fruit names to distinct colors, while the size legend uses `scaleSqrt` with `ticks()` and `reverse()` to display descending circle radii. The reusable `colorLegend` and `sizeLegend` functions handle enter, update, and exit selections via `selection.merge()`, with spacing and text offsets configured through props. Styling for tick labels and circles comes from CSS classes defined in `styles.css`.","provider_name":"VizHub AI Studio","provider_url":"https://vizhub.com","html":"<iframe src=\"https://vizhub.com/viz/59cafe77138048adb94e513595e1b7c0?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"0\"></iframe>","width":960,"height":500,"cache_age":3600}