Gathering detailed insights and metrics for d3-svg-legend
Gathering detailed insights and metrics for d3-svg-legend
Gathering detailed insights and metrics for d3-svg-legend
Gathering detailed insights and metrics for d3-svg-legend
d3-color-legend
SVG color legends for continuous or discrete D3 scales
odc-d3-svg-legend
A legend component for d3. Given a d3.scale it can create either a color legend, size legend, or symbol legend. Fork of d3-svg-legend updated to d3.js v7
infocharts
<img src="https://raw.githubusercontent.com/garethslinn/public_infocharts/refs/heads/main/logo.svg" />
npm install d3-svg-legend
Typescript
Module System
Node Version
NPM Version
Fix: bug with threshold helper labels
Updated on Feb 07, 2018
Fix: bug in color legend updating
Updated on Dec 10, 2017
Fix: Previously inconsistent label offset from size line legends
Updated on Dec 10, 2017
Added Locale Support on all Legend Types
Updated on Nov 17, 2017
Upgrade to d3 v4
Updated on Nov 17, 2017
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
725 Stars
183 Commits
104 Forks
18 Watchers
5 Branches
17 Contributors
Updated on Mar 03, 2025
Latest Version
2.25.6
Package Id
d3-svg-legend@2.25.6
Size
181.85 kB
NPM Version
4.1.2
Node Version
7.7.3
Published on
Mar 31, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Full documentation: http://d3-legend.susielu.com
You must include the d3 library before including the legend file. Then you can simply add the compiled js file to your website:
You can also add the latest version of d3-legend hosted on cdnjs.
You can add the d3 legend as a node module by running:
npm i d3-svg-legend -S
To use the version compatible with d3v3 run:
npm i d3-svg-legend@1.x -S
Using the import syntax import legend from 'd3-svg-legend'
gives access to the three legend types as an object. You can also import them independently for example import { legendColor } from 'd3-svg-legend'
var svg = d3.select("#svg-color-quant");
var quantize = d3.scaleQuantize()
.domain([ 0, 0.15 ])
.range(d3.range(9).map(function(i) { return "q" + i + "-9"; }));
svg.append("g")
.attr("class", "legendQuant")
.attr("transform", "translate(20,20)");
var colorLegend = d3.legendColor()
.labelFormat(d3.format(".2f"))
.useClass(true)
.scale(quantize);
svg.select(".legendQuant")
.call(colorLegend);
I would love to hear from you about any additional features that would be useful, please say hi on twitter @DataToViz.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/26 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
95 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More