Color and Size Legends
✓ Published0🌍 Public
This example demonstrates two interactive legends for mapping data to visual channels in D3 v5. A color legend uses `scaleOrdinal` to associate fruit names with distinct hues, while a size legend employs `scaleSqrt` to encode numeric values through circle radii. Both legends animate their tick marks using `transition().duration(3000)` as they enter or update. The code implements custom legend components through D3 selections and data joins, rendering SVG circles and text elements with configurable spacing and offsets.
AI-generated descriptionDemonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.
MIT Licensed