Skip to main content
100%

colorsize legnds

✓ Published0🌍 Public
YYanxxx447
Last edited Jan 12, 2021
Created on Jan 12, 2021

This example demonstrates two types of legends for encoding data: a color legend for categorical fruit names and a size legend for a continuous numeric scale. Both legends render as SVG groups with circles and text labels, using d3.scaleOrdinal and d3.scaleSqrt to map data to visual properties. The fruitBowl module creates the color legend, while the sizeLegned module generates circles whose radii correspond to tick values. The code imports from the d3 library via UNPKG and uses local ES6 modules, with an SVG canvas in the HTML file.

AI-generated description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes