score:12

Accepted answer

Try:

d3.selectAll("circle").style("fill", "green");

Or:

allCircles.style("fill", "PaleGoldenRod");

Explanation: d3.selectAll will return a selection, which can be acted upon using the functions described in this API: https://github.com/d3/d3/blob/master/API.md#selections-d3-selection

However, as soon as you do forEach, the internal variable returned each time as circle will be an actual DOM element - no longer a selection, and therefore no style function attached.


Related Query

More Query from same tag