dagrejs / dagre-d3

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

Setting parent causes rendering to fail #332

Open jsommr opened 6 years ago

jsommr commented 6 years ago

When assigning a parent to a node, the rendering fails with TypeError: label is undefined.

Example: http://jsbin.com/qemoqitowa/edit?html,output (look for "parent": "Flow TWO")

If I don't assign a parent, the graph is rendered correctly: http://jsbin.com/zozixipugo/edit?html,output (only difference is that "parent": "Flow TWO" is removed)

joshchamberlain commented 5 years ago

I was getting the same error, bringing me to your post. Your example does not currently have any usage of parent. When I run the example, it doesn't render because the SVG dimensions are incorrect.

By changing the SVG line to the following, your first example works: <svg id="svg-canvas" width=500 height=500></svg>

In my case, I eventually realized my TypeError: label is undefined error came from creating an edge between a child and a parent.

I suggest closing this issue and consider filing an enhancement request to make the error message more useful, assuming that is actually the cause of the error.

joshchamberlain commented 5 years ago

Possibly related: #152