datumSet method

Selection datumSet(
  1. Union2<EachCallback<JSAny?>, JSAny?>? value
)

Sets the element’s bound data to the specified value on all selected elements.

If the value is a constant, all elements are given the same datum; otherwise, if the value is a function, it is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with thisArg as the current DOM element (nodes[i]). The function is then used to set each element’s new data. A null value will delete the bound data.

Unlike selection.dataBind, this method does not compute a join and does not affect indexes or the enter and exit selections.

Implementation

Selection datumSet(Union2<EachCallback<JSAny?>, JSAny?>? value) {
  return propertySet("__data__", value);
}