selection.call(function[, arguments…])
Invokes the specified function exactly once, passing in this selection along with any optional arguments. Returns this selection. This is equivalent to invoking the function by hand but facilitates method chaining. For example, to set several styles in a reusable function:
function name(selection, first, last) {
selection
.attr("first-name", first)
.attr("last-name", last);
}
Now say:
d3.selectAll("div").call(name, "John", "Snow");
This is