D3力布局图造成firefox浏览器慢 [英] D3 force layout graph causes slowness in firefox browser

查看:174
本文介绍了D3力布局图造成firefox浏览器慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个动态力图,每3分钟运行一次(使用setInterval我调用更新,从下面的顺序开始)

I have a dynamic force graph which runs every 3 mins (using setInterval I am calling update, start in the below order)


  • viz.update(); //从服务器附加新数据,如viz.path.data(data.links)

  • viz.nodes.data 。)

  • viz.enter(); // viz.path.enter()。append(path)

  • viz.exit // path.exit()。remove()

  • force.start(); li>
  • viz.update(); //attach new data from server like viz.path.data(data.links),
  • viz.nodes.data(..)
  • viz.enter(); // viz.path.enter().append("path")
  • viz.exit(); // path.exit().remove()
  • force.start();

当我离开浏览器打开一段时间,浏览器减慢,节点移动缓慢,当我拖动它们。我在这里缺少一些东西..

when I leave the browser open for sometime, browser slows down and the nodes move slowly when I drag them. Am I missing some thing here..

帮助赞赏。
感谢。

Help appreciated. Thanks.

推荐答案

Firefox中的SVG性能比Webkit / Chrome和IE10慢。

SVG performance in Firefox is slower than in Webkit/Chrome and IE10.

在Firefox中的性能还不错。您可以尝试一些操作。

Still performance in Firefox is not bad. There are a few things you can try.


  • 确保您不会留下未使用的/空元素(例如< g> ,并有一切正确清理。太多元素会快速影响您的效果。

  • 减少使用不透明度的节点数量,尽量少使用它。

  • 元素的数量。

我也做了一件事,但不确定如果它是任何帮助,是调用force.stop )再次调用force.start()之前。

One thing I also did, but not sure if it is any help, was to call force.stop() before calling force.start() again.

这篇关于D3力布局图造成firefox浏览器慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆