1

我正在尝试调整此示例http://bl.ocks.org/kerryrodden/7090426

在此处输入图像描述

以便将鼠标悬停在选择所有同名段而不是当前段的祖先。

这是脚本

  vis.selectAll("path")
      .filter(function(node) {
                return (sequenceArray.indexOf(node) >= 0);
              })
      .style("opacity", 1);
}

感谢您的帮助

4

1 回答 1

1

The code that you mentioned in the question should be replaced with the following code:

  var currentName = d.name;
  vis.selectAll("path")
      .filter(function(node) {
                return (node.name == currentName);
              })
      .style("opacity", 1);
}

The effect is shown here: (demo jsfiddle is also available; this is somewhat scaled down version of the original example that I used for debugging; also, this jsfiddle is the version with original highlighting, if you can make use of it)

enter image description here

于 2014-07-05T00:04:23.640 回答