javascript - How to deal with multiple trees situation when using dagre layout in Cytoscape.js -
i'm new cytoscape.js , trying draw graph of dagre layout depending on users' search input. number of nodes typically 50-100.
although dagre works single tree, when graph contains several trees (and includes independent nodes), roots of these trees automatically arranged horizontally(as picture shown), makes nodes , labels become small. if can take advantage horizontal space, graph surely clearer.
my question how can deal multiple-tree situation, vertically arrange trees (for example, 4 roots in line , others can arranged under these trees) utilize layout space.
take @ rankdir
option orientation of layout : http://js.cytoscape.org/#layouts/dagre
for more control, try running 1 layout per subgraph/tree: http://js.cytoscape.org/#collection/layout
you can control subgraph position using boundingbox
each subgraph.
also see dagre docs details on config options : https://github.com/cpettitt/dagre/wiki
Comments
Post a Comment