Tag: 和弦

在D3强制指示图中突出显示所选节点及其链接和子节点

我正在研究D3中的一个有向图。 我想通过将所有其他节点和链接设置为较低的不透明度来突出显示mouseover'd节点,其链接及其子节点。 在这个例子中,我可以淡出所有的链接和节点,然后淡入连接的链接,但到目前为止,我还没有能够优雅地淡入淡出连接的节点是当前鼠标hover节点的子节点。 这是代码中的关键function: function fade(opacity) { return function(d, i) { //fade all elements svg.selectAll("circle, line").style("opacity", opacity); var associated_links = svg.selectAll("line").filter(function(d) { return d.source.index == i || d.target.index == i; }).each(function(dLink, iLink) { //unfade links and nodes connected to the current node d3.select(this).style("opacity", 1); //THE FOLLOWING CAUSES: Uncaught TypeError: Cannot call method 'setProperty' of undefined […]