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

unable to layout compound graph #467

Open
qkaihui opened this issue Jan 8, 2025 · 1 comment
Open

unable to layout compound graph #467

qkaihui opened this issue Jan 8, 2025 · 1 comment

Comments

@qkaihui
Copy link

qkaihui commented Jan 8, 2025

// code
const g = new dagre.graphlib.Graph({compound:true})
g.setGraph({ rankdir: 'TB', nodesep: 100, ranksep: 80,marginx:100,marginy:100,})
g.setDefaultEdgeLabel(() => ({}))

nodes.forEach((node) => {
const {width,height} = node.size()
const parentId = node?.parent?.id ?? undefined
if(parentId) g.setParent(node.id,parentId)
g.setNode(node.id, {label:${node.id},width, height})
})
dagre.layout(g)

// console error
chunk-YSKSNXDD.js?v=349623b9:5910 Uncaught TypeError: Cannot set properties of undefined (setting 'rank')

How should I solve this problem?

@GidonKesslerTruestate
Copy link

Im struggling with the same issue 🙏

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

2 participants