dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.85k stars 587 forks source link

Alignment of Groups in multigraphs #204

Open botev opened 8 years ago

botev commented 8 years ago

Is it possible to somehow enforce some alignment? At the moment I have this: screenshot from 2015-12-17 20 01 27

The issue is that the alignment of the two groups is very bad. If there are no groups the nodes look like this: screenshot from 2015-12-17 20 01 58 What I'm trying is to achieve something similar to the second picture, but just draw boundaries between the two group of nodes. Is this possible (e.g. make the groups one below the other)?

cpettitt commented 8 years ago

For now you can do it by adding an invisible edge from a sink in the first subgraph to a source in the second subgraph. Here's an example:

http://cpettitt.github.io/project/dagre-d3/latest/demo/interactive-demo.html?graph=digraph%20%7B%0A%7B%20A%20-%3E%20B%20-%3E%20C%20%7D%0A%7B%20B%20-%3E%20D%20-%3E%20E%20%7D%0AC%20-%3E%20D%20%5Bstyle%3D%22visibility%3A%20hidden%22%5D%0A%7D

An easier way to do this would be cluster to cluster edge, but those are not supported yet.