D3/GraphGL 力定向网络可视化的放大镜效果?
使用 D3
或 GraphGL
将鼠标悬停在力导向图形可视化中的节点上时,是否可以创建平滑的动画放大效果(类似于 Mac OS X 上的扩展坞)图书馆?
这些节点需要扩展并取代周围的其他节点,同时保持力导向的布局。
如果有人可以分叉来演示,那就太好了!谢谢
注意,这与 这个问题
Is it possible to create a smooth animated magnifying effect (similar to the dock on Mac OS X) when hovering over nodes in a force-directed graph visualization using the D3
or GraphGL
libraries?
The nodes would need to expand and displace the others around it, while maintaining the force-directed layout.
If someone could fork this to demonstrate, that would be great! Thanks
note, this is different from a simple zoom as in this question
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
很好的问题。为了回答这个问题,我为 D3 插件 实现了.com/d3/d3-plugins/tree/master/fisheye" rel="nofollow noreferrer">鱼眼失真。它大致基于 Flare 和 Sigma.js 之前的工作,而后者又基于 Sarkar 和 Brown 的工作,“图表的图形鱼眼视图”,CHI'92。
这是使用 Misérables 数据集的快速演示。查看代码的源代码。今天晚些时候,当我有时间的时候,我会写一篇文章。
注意:这里使用静态力布局;布局是在启动时计算的并且不会改变。我认为这可能是您想要与鱼眼失真结合使用的效果,否则失真将与您动态移动节点的能力相竞争。但理论上,如果您愿意的话,可以将它们结合起来。
Great question. To answer it, I implemented a D3 plugin for fisheye distortion. It's roughly based on previous work in Flare and Sigma.js, which are in turn based on the work of Sarkar and Brown, "Graphical Fisheye Views of Graphs", CHI'92.
Here's a quick demo with the Misérables dataset. View source for the code. I'll do a writeup later today when I have time.
Note: this uses a static force layout; the layout is computed on startup and doesn't change. I think this is probably what you want in conjunction with fisheye distortion, or else the distortion will compete with your ability to move nodes around dynamically. But in theory it's possible to combine them, if that's what you want.
如果您可以使用纯 CSS 来完成此操作,那就太棒了,但不幸的是,看起来各种 SVG 元素(即圆圈)的属性无法通过 CSS 访问。特别是“半径”,但我认为对于所有 SVG 元素属性来说都是如此。
但通过 d3 做到这一点并不难。这是我的示例 jsfiddle。基本上,您执行以下操作:
d3element.transition().delay(300).attr(...)
来使更改发生。希望这就是您正在寻找的...
It'd be amazing if you could do this with pure CSS, but unfortunately it looks like attributes for various SVG elements (ie, circles) aren't reachable via CSS. Specifically 'radius', but I think this is true for a whole slew of SVG element properties.
But its not super hard to do via d3. Here is my example jsfiddle. Basically you do the following:
d3element.transition().delay(300).attr(...)
to make the changes happen.Hopefully thats what you are looking for...
如果你接受的话,纯 css 可以做到这一点。
它用在我的主页上tuoxie.me
Pure css can do this if you accept it.
It's used on my home page tuoxie.me