Open Mamba-working opened 4 years ago
i want to mock data for this picture.
A quick search of the repo shows that your error message is coming from here: https://github.com/dagrejs/dagre/blob/5532d13fc608cff7dda54096ccc4efad4d57581c/lib/layout.js#L389
Have you tried putting a print/log statement there to see what value it's failing on?
I'm having pretty much the same set up (just without X6
lib) and ran into the same issue.
k.toLowerCase is not a function
that comes from dagre/lib/layout.js
function canonicalize(attrs) {
var newAttrs = {};
_.forEach(attrs, function(v, k) {
newAttrs[k.toLowerCase()] = v;
});
return newAttrs;
}
Can't figure out what attributes are missing or having a wrong type (not a string
).
UPD: A little debugging shows that it has to do with the edges of graph (remove the edges and the error goes away).
I also ran into this issue. Luckily I had one graph that worked and another that hit this so I was able to compare and see what was different. It seems it has to do with the default edge label. For some reason passing an empty string or constant string does not work, but an empty object does 😕
Try changing:
g.setDefaultEdgeLabel(() => 'no label');
to:
g.setDefaultEdgeLabel(() => ({}));
I would have to do more debugging to see why this matters but for now it should unblock you. The option of not setting edges has the effect of not needing to get a default label for the edges which don't have one which is why removing edges works, but that isn't feasible since graphs need edges.
Hope it helps someone!
Hello, here is my code.But it cant work, but i dont know why.
It is code sandbox to reproduce it. It is a bug or what?🤣