Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@flourish/legend
Advanced tools
npm install --save @flourish/legend
Then import into you project like this: import createLegend from "@flourish/layout"
In your template.yml, add:
- property: legend
import: "@flourish/legend"
To your state, add:
state: {
"legend": {}
}
Inside your template init
code, initialize the legend component like this: var legend = createLegend(state.legend)
legend.appendTo(target_container)
where target_container
is a node element, for example layout.getSection("legend")
legend
.type("ordinal") // String, "ordinal" is only option for now
.data(array, color_function(optional)) // See explanation below
.filtered(["Brazil"]) // Array, items that should have low opacity
.on("click", function(d) { // Add event listener to legend items (eg. "click", "mouseover", etc.)
console.log(this, d, i); // Legend item node element, "Brazil", 0
})
.update(); // Update the legend
There are two ways to add data to your legend.
var legend_items = [
{
label: "Brazil",
color: "#ff0000"
},
{
label: "Argentina",
color: "#000000"
}
]
legend.data(legend_items);
var getColor = initializeColors(state.color).getColor; // Using Flourish custom colors module
// var getColor = function(label, i) { return color_list[label]; } // Or create your own function, referencing an object/array with colors
var legend_items = ["Brazil", "Argentina"];
legend.data(legend_items, getColor)
legend.getContainer()
Gets the legend node element
FAQs
Flourish module for making legend
The npm package @flourish/legend receives a total of 64 weekly downloads. As such, @flourish/legend popularity was classified as not popular.
We found that @flourish/legend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.