Using d3 SVG legend @d3-svg-legend / Ashish Singh / Observable
observablehq.com
Using d3 SVG legend @d3-svg-legend The legend uses getBBox() internally to determine the height of a text label and accordingly calculates translate values and positions the legend labels. For cases when the target container does not have a layout, this mechanism fails. To overcome such scenarios, the shapePadding() property can be put into use. Define Scale type with domain/range Define Legend type Draw the SVG legend Includes
#bookmarked_on_site #D3 #javascript #code #code_examples #data_visualization #$project_2018_js #dev #pub
Collect and share the web
Get started for free