I\'d like to get an array of all the data attached to a selection in D3.
I\'m working with the example from the General Update pattern, and trying this:
If you want to access the entire data array from within a modification function, e.g., selection.attr
, you can use the fact that the entire selection is passed to the modification function as its third argument. So you can reconstruct the data array as follows:
mySelection.attr("stroke", (_, __, nodes) => {
let data = d3.selectAll(nodes).data()
// Now you can use data.
}