【发布时间】:2015-11-17 12:10:18
【问题描述】:
我正在尝试在大型 Tilfold-Reingold 图(约 4000 个对象)中使用 Fisheye.js 效果。我想要的效果类似于this example。
我必须错误地使用 Fisheye.js,因为我的示例似乎没有影响所需的节点或文本(根本)。
https://jsfiddle.net/Nyquist212/7b7q9ra9/
谁能告诉我我做错了什么?
svg.on("mousemove", function() {
fisheye.focus(d3.mouse(this));
node.each(function(d) { d.fisheye = fisheye(d); })
node.selectAll("circle")
.attr("cx", function(d) { return d.fisheye.x - d.x; })
.attr("cy", function(d) { return d.fisheye.y - d.y; })
.attr("r", function(d) { return d.fisheye.z * 10; });
node.select("text")
.attr("dx", function(d) { return d.fisheye.x - d.x; })
.attr("dy", function(d) { return d.fisheye.y - d.y; });
});
更新:目的是针对每个节点和相关的描述文本,使它们更具可读性。
【问题讨论】:
-
在您的代码中,当
mouse-moves时,您正在对所有节点进行鱼眼。那么当鼠标移动时,你想要在单个节点上还是全部节点上是什么????也只是节点半径从 2 得到 10。请提供更多信息。 -
@Hashy 我正在尝试对每个节点和相应的文本标签应用鱼眼失真,以使其更具可读性。
-
看到这个问题here。必须使鱼眼与放射状布局相得益彰......
标签: javascript select d3.js fisheye