D3.js Fisheeye.js奇怪的鼠标移动行为
D3.js Fisheye.js strange mousemove behavior
我正试图在大型Tilfold Reingold图(约4000个对象)中使用Fisheye.js效果。我想要的效果就是这个例子。
我一定是错误地使用了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; });
});
更新:目的是针对每个节点和相关的描述文本,使它们更具可读性。
我摆弄着你的小提琴。我注意到,svg变量并不像它的名字所暗示的那样。我还设法增加了文本的大小。这仍然有点奇怪,但我认为它离你的目标更近了。
d3.select("svg").on("mousemove", function() { //here
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; })
.attr("style", function(d){return "font-size :"+d.fisheye.z*10+"px";}); //here
});
https://jsfiddle.net/7b7q9ra9/23/
@Mark-感谢您提供此文章的链接
@彼得-谢谢你的文字标签部分。
我设法把两者结合起来。
http://fiddle.jshell.net/Nyquist212/w05nkyry/3/
相关文章:
- Video.js+移动设备上的谷歌IMA:'点击'导致错误的事件
- JS-移动图像,暂停设置的时间,然后将图像向后移动
- 如何通过JS移动元素位置而不闪烁
- JS移动重定向到/mobile/而不是m
- 视差.js移动我的 CSS 定位元素
- jQuery.BlackAndWhite.js移动设备上不稳定
- 通过jQuery或JS移动鼠标
- 页面冻结,不要使用循环js移动wihle
- 使用d3.js移动折线图
- 在Snap.js移动面板插件中添加“destroy”方法
- 如何使js移动脚本具有可重复性
- d3.js移动平均线图(自定义插值)与工具提示
- 如何将控制器源代码从app.js移动到angular项目中所需的文件夹位置
- JS移动:我有多少内存可用
- 使用OrbitControls.js移动摄像机和灯光
- 织物js移动图像与键盘
- 当使用fabric.js移动元素时,如何将图像保持在画布的后面
- Node.js移动繁重的CPU绑定任务
- Fabric js:移动时不更新组成员
- Angular.js移动动画