Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
d3-svg-legend
Advanced tools
A legend component for d3. Given a d3.scale it can create either a color legend, size legend, or symbol legend.
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.
FAQs
A legend component for d3. Given a d3.scale it can create either a color legend, size legend, or symbol legend.
The npm package d3-svg-legend receives a total of 13,218 weekly downloads. As such, d3-svg-legend popularity was classified as popular.
We found that d3-svg-legend demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.