未验证 提交 07182425 编写于 作者: D daminglu 提交者: GitHub

(Small Progress): Multiline compound node and styling (#354)

上级 6454bf09
...@@ -67,8 +67,11 @@ ...@@ -67,8 +67,11 @@
var nodeKeys = []; var nodeKeys = [];
var buildInputNodeLabel = function(inputNode) { var buildInputNodeLabel = function(inputNode) {
var nodeLabel = inputNode['data_type'] + ': ' + inputNode['shape'].join('x'); // TODO(daming-lu): need more complex compound node
return nodeLabel + ' '.repeat(Math.floor(nodeLabel.length/5)); var nodeLabel = 'id: ' + inputNode['name'] + '\n'
+ 'type: ' + inputNode['data_type'] + '\n'
+ 'dims: ' + inputNode['shape'].join(' x ');
return nodeLabel;
}; };
// add input nodes // add input nodes
...@@ -119,11 +122,15 @@ ...@@ -119,11 +122,15 @@
g.setEdge(nodeKey, curOperatorNode['output'][0]); g.setEdge(nodeKey, curOperatorNode['output'][0]);
} }
// TODO(daming-lu): add prettier styles to diff nodes
var svg = d3.select("svg")
.attr("font-family", "sans-serif")
.attr("font-size", "28px");
render(d3.select("svg g"), g); render(d3.select("svg g"), g);
// adjust viewBox so that the whole graph can be shown, with scroll bar // adjust viewBox so that the whole graph can be shown, with scroll bar
d3.select("svg") svg.attr('viewBox', '0 0 ' + g.graph().width + ' ' + g.graph().height);
.attr('viewBox', '0 0 ' + g.graph().width + ' ' + g.graph().height);
}); });
}, },
...@@ -232,13 +239,17 @@ ...@@ -232,13 +239,17 @@
stroke-width: 1.5px stroke-width: 1.5px
.operator .operator
fill: red fill: #41b3a3
.operator > rect
rx: 10;
ry: 10;
.output .output
fill: green fill: #c38d9e
.input .input
fill: purple fill: #e8a87c
.visual-dl-graph-charts .visual-dl-graph-charts
width inherit width inherit
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册