Based on this example, I use dagre-d3 to render a graph within an angularjs' directive.
It works fine with simple label on node:
nodes.forEach(function(node) {
g.setNode(node.num, {
labelType: "html",
label: "<b>"+node.name+"</b>",
class: "comp",
width: 150
});
});
But when I want to render more content on each node like this:
nodes.forEach(function(node) {
html = '<div> Header</div>'
html += '<div>'+node.name+'</div>'
html += '<div>Footer</div>'
g.setNode(node.num, {
labelType: "html",
label: html,
class: "comp",
width: 150
});
});
Then the size of each node doesn't fit with the node content.
After some googling, I understood that the height of the node is compute by dagre.core.js. I check that the lib is correctly loaded. Now, I'm not sure where to look. Does anyone have an idea how to correctly render the node?
I had similar problem. Check my example:
My HTML label:
Style:
My JSFidlle: https://jsfiddle.net/damiankoprucki/npLv7gzv/16/
In my case I have to set width and height in CSS for 'div' inside HTML label.
Hope it help you ;)