attrize
Applies each key/value in an object as an attr.
Basic example
Section titled “Basic example”Applies every key of an object as an attribute on a d3 selection, one .attr() call per entry. elem uses it for its enter, update, and exit attribute sets; stylize is the same idea for inline styles.
import {select} from "d3-selection";
import {attrize} from "@d3plus/dom";
attrize(select("rect"), {
width: 120,
height: 40,
rx: 6,
fill: "#1c7ed6",
"data-label": "attrized",
});
Parameters
import {attrize} from "@d3plus/dom";