Build a "group by attributes" with cytoscape.js

1.2k views Asked by At

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

There are 1 answers

2
maxkfranz On

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

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