Is there a way to select all circle
with style visibility===visible
? Something like this:
svg.selectAll("circle").filter(function(d) { return this.style.visibility === 'visible'; })
Asked
Active
Viewed 77 times
1 Answers
-1
You can use d3.selectAll to select all circle svgs (https://github.com/mbostock/d3/wiki/Selections#d3_selectAll).
This is going to return a 2 dimensional array. It's essentially an array containing arrays of what you selected. Assuming you have 25 circles:
circs = d3.selectAll("circle") // here circs may be [Array[25]]
circs = circs[0] //now circs is an array of circles
Now all you need to do is filter based on the computed style for that element. Check out this answer for how you'd do that :)