建立“按属性分组”。与cytoscape.js [英] Build a "group by attributes" with cytoscape.js

查看:364
本文介绍了建立“按属性分组”。与cytoscape.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery和cytoscape.js开发一个小型应用程序。我几乎可以完成我所期望的工作,但是,在这个主题上,我被封锁了好几天:我想用 group by attribute布局使图形类似于在Cytoscape中可以执行的图形。在Cytoscape中,渲染是带有圆圈的,但也可以是每个组的其他布局。我找不到示例,但尝试使用boundingBox或pan()失败。

I'm developping a small application with jquery and cytoscape.js. I can do almost what I expect, however, I'm blocked for several days on this topic : I would like to render the graph similar to what I can do in Cytoscape with the layout "group by attribute". In Cytoscape, the rendering is with circles, but it could be other layout per group. I was unable to find examples and I tried unsucessfully with boundingBox or pan().

已过滤的节点组以正确的布局显示(例如:网格或圆形,等等...),但居中。我有这样的东西:

The group of nodes filtered is displayed with the right layout (eg: grid or circle, etc...) but centered on the middle. I have something like that:

var person = cy.nodes()。filter(’[Type = Person]’)。select();
cy.elements(:selected)。layout({name:'circle',boundingBox:{x1:'300',y1:'4OO',h:'500',w:'500'} });

var persons= cy.nodes().filter('[Type="Person"]').select(); cy.elements(":selected").layout({ name: 'circle', boundingBox:{x1:'300', y1:'4OO', h:'500', w:'500'}});

是否存在我没​​有看到的现有布局?
我该怎么办?

Is there an existing layout I didn't see? How can I do?

我不是一个强大的 javascrip开发人员:)

I'm not a "poweful" javascrip developper :)

谢谢

推荐答案

使用同心布局: http://js.cytoscape.org/#layouts/concentric

设置 concentric levelWidth 适当地将节点分组为同心圆。

Set concentric and levelWidth appropriately to group your nodes in concentric circles as desired.

这篇关于建立“按属性分组”。与cytoscape.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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