Skip to main content
100%

Bowl of Fruit - General Update Pattern Special Cases

✓ Published0🌍 Public
Aaidanoconnor1
Last edited Dec 2, 2019
Created on Dec 2, 2019

This example demonstrates two custom legend components for categorical and quantitative scales, applied to a fruit-themed visualization. The color legend maps fruit types (apple, lemon, lime, orange) to distinct colors, while the size legend uses a square-root scale for proportional circle sizing. Built with D3 v5, it uses selection joins (`enter`, `merge`, `exit`) to handle updates dynamically, rendering SVG elements with `d3.scaleOrdinal` and `d3.scaleSqrt`. The code defines reusable functions for both legends, which are called on separate SVG groups with explicit spacing and text offsets.

AI-generated description
MIT Licensed

Similar vizzes