Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dagre.layout() options not taken into account #461

Open
loicknuchel opened this issue Nov 15, 2024 · 0 comments
Open

dagre.layout() options not taken into account #461

loicknuchel opened this issue Nov 15, 2024 · 0 comments

Comments

@loicknuchel
Copy link

Hi,

I'm integrating dagre into https://github.com/azimuttapp/azimutt (an ERD tool) and it looks like when I change options in the dagre.layout function, I still get the same result 😅
I followed the https://github.com/dagrejs/dagre/wiki#an-example-layout, here is my code:

const g = new dagre.graphlib.Graph()
g.setGraph({})
g.setDefaultEdgeLabel(() => ({}))
nodes.forEach(n => g.setNode(n.id, {width: n.size.width, height: n.size.height}))
edges.forEach(e => g.setEdge(e.src, e.ref))
dagre.layout(g, {rankdir: 'LR', nodesep: 20, edgesep: 0, ranksep: 20}) // these options don't change anything, tried LR, TB, BT... rankdir and more :/
app.gotAutoLayout(g.nodes().map(id => {
    const node = g.node(id)
    return {id, size: {width: node.width, height: node.height}, pos: {left: node.x, top: node.y}}
}))

Any idea why?

Also, is there a way to "freeze" existing nodes? When I'm adding a new entity (in my ERD), I want to get a good position for it but not change anything else. Is it possible with dagre?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant