Color and size legend
✓ Published0🌍 Public
Two reusable D3 legend components illustrate how to encode data with color and size. The color legend maps ordinal categories to colored circles using `d3.scaleOrdinal`, while the size legend uses `d3.scaleSqrt` to size circles by numeric ticks. Both render as SVG groups with `.tick` classes, updating via D3's data-join pattern. The legends demonstrate custom legend-building with explicit spacing, text offsets, and tick filtering.
AI-generated descriptionMIT Licensed