我找不到(希望如此)非常简单的问题的答案。我在这个和弦图示例中使用过滤http://bl.ocks.org/mbostock/4062006 :
.filter(function(d) { return d.source.index != i && d.target.index != i; })
我现在需要的是只过滤那些带有橙色填充的连接。有没有像
.filter(style('fill') == 'orange')
那个有效?任何建议高度赞赏。
最佳答案
要使用 fill = orange 搜索所有内容,您可以执行以下操作:
svg.selectAll('path[style = "fill: orange;"]')
如果要将搜索限制为特定元素类型,例如“rect”,可以执行以下操作:
svg.selectAll('rect[style = "fill: orange;"]')
关于d3.js - 使用 D3 按属性过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24939484/