Build a “group by attributes” with cytoscape.js

て烟熏妆下的殇ゞ 提交于 2020-05-30 06:31:42

问题


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 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?

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

Thank you


回答1:


Use the concentric layout: http://js.cytoscape.org/#layouts/concentric

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



来源:https://stackoverflow.com/questions/30798491/build-a-group-by-attributes-with-cytoscape-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!