How to configure Cytoscape headless layout?

246 views Asked by At

I want to draw a graph from a bunch of nodes. Dagre (https://github.com/dagrejs/dagre) was fine so far, as long as I didn't have to draw the inputs/outputs. I'd like to render something like this:

enter image description here

So I'd like to use cytoscape (https://js.cytoscape.org/) with custom drawings for nodes. What's more, I've already several mouse interactions with the canvas used to draw the nodes. That's why I tried to use cytoscape (with dagre layout extension at the moment) in headless mode, grag the nodes coordinates at the end, and then render the graph myself. Problems are: I can't set specific size for each node (despite the fact that I set a width and height in the node style option, even tried setting the node selector style with some values), and cytoscape doesn't seems able to generate a proper layout from scratch (without defining initial bounds). For example, dagree by itself, renders all the nodes positions and is able to calculate the layout size which includes all the nodes. If no bounds are set in cytoscape options, all nodes are basically at the same location, sometime event with negative position values.

Any idea how to achieve that?

I hope I was understandable ;-)

Thanks for your help!

0

There are 0 answers