Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 D3 中选择多个选择器selectAll?
selectAll
我想要svg.selectAll("class1", "circle", "id2")选择所有circle元素,class1元素和id2元素。
svg.selectAll("class1", "circle", "id2")
circle
class1
id2
这可能吗?
是的,您只需将逗号放在选择器字符串中,而不是传递单独的字符串:
svg.selectAll(".class1, circle, #id2")
我假设“class1”是一个css类,“circle”是一个标签名,“id2”是一个ID属性值。