D3/GraphGL 力定向网络可视化的放大镜效果?

发布于 2024-12-29 04:44:40 字数 390 浏览 1 评论 0原文

使用 D3GraphGL 将鼠标悬停在力导向图形可视化中的节点上时,是否可以创建平滑的动画放大效果(类似于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

橙幽之幻 2025-01-05 04:44:40

很好的问题。为了回答这个问题,我为 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.

呆萌少年 2025-01-05 04:44:40

如果您可以使用纯 CSS 来完成此操作,那就太棒了,但不幸的是,看起来各种 SVG 元素(即圆圈)的属性无法通过 CSS 访问。特别是“半径”,但我认为对于所有 SVG 元素属性来说都是如此。

但通过 d3 做到这一点并不难。这是我的示例 jsfiddle。基本上,您执行以下操作:

  1. 使用过渡(请参阅 教程 #2 来学习如何使用这些)。基本上执行 d3element.transition().delay(300).attr(...) 来使更改发生。
  2. 为了防止“放大”的圆圈重叠,我能想到的最好办法是修改 强制布局的收费设置。当圆圈较大时,增加排斥力。

希望这就是您正在寻找的...

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:

  1. Use transitions (see Tutorial #2 to learn how to use these). Basically do a d3element.transition().delay(300).attr(...) to make the changes happen.
  2. To keep the 'blown up' circles from overlapping the best I could figure out to do was to modify the force layout's charge setting. Increasing the repulsive forces when circles are larger.

Hopefully thats what you are looking for...

情话已封尘 2025-01-05 04:44:40

如果你接受的话,纯 css 可以做到这一点。

.app{
-webkit-transition-property:-webkit-transform;
-moz-transition-property:-moz-transform;
-transition-property:-transform;
-webkit-transition-duration:.15s;
-moz-transition-duration:.15s;
-transition-duration:.15s;
}

.app:hover{
-webkit-transform:scaleX(1.2) scaleY(1.2);
-moz-transform:scaleX(1.2) scaleY(1.2);
-transform:scaleX(1.2) scaleY(1.2);
}

它用在我的主页上tuoxie.me

Pure css can do this if you accept it.

.app{
-webkit-transition-property:-webkit-transform;
-moz-transition-property:-moz-transform;
-transition-property:-transform;
-webkit-transition-duration:.15s;
-moz-transition-duration:.15s;
-transition-duration:.15s;
}

.app:hover{
-webkit-transform:scaleX(1.2) scaleY(1.2);
-moz-transform:scaleX(1.2) scaleY(1.2);
-transform:scaleX(1.2) scaleY(1.2);
}

It's used on my home page tuoxie.me

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文