Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
375dd77a
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 2 年 前同步成功
通知
89
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
375dd77a
编写于
4月 05, 2018
作者:
D
daminglu
提交者:
GitHub
4月 05, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prettifier graph nodes (#367)
上级
db62d42b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
17 deletion
+45
-17
frontend/src/graph/ui/Chart.vue
frontend/src/graph/ui/Chart.vue
+45
-17
未找到文件。
frontend/src/graph/ui/Chart.vue
浏览文件 @
375dd77a
...
...
@@ -21,10 +21,25 @@
// for d3 drawing
import
*
as
d3
from
'
d3
'
;
import
*
as
dagre
from
'
dagre
'
;
export
default
{
props
:
[
'
fitScreen
'
,
'
download
'
,
'
scale
'
,
'
curNode
'
],
props
:
{
'
fitScreen
'
:
{
type
:
Function
,
required
:
true
,
},
'
download
'
:
{
type
:
Function
,
required
:
true
,
},
'
scale
'
:
{
type
:
Number
,
default
:
1
,
},
'
curNode
'
:
{
type
:
Object
,
default
:
{},
}},
computed
:
{
computedWidth
()
{
let
scale
=
this
.
scale
;
...
...
@@ -55,15 +70,16 @@
this
.
getOriginChartsData
();
let
chartScope
=
this
;
getPluginGraphsGraph
().
then
(({
errno
,
data
})
=>
{
let
raw_data
=
data
.
data
;
var
data
=
raw_data
;
let
graphData
=
data
.
data
;
// d3 svg drawing
let
g
=
new
dagreD3
.
graphlib
.
Graph
()
.
setGraph
({})
.
setDefaultEdgeLabel
(
function
()
{
return
{};
});
return
{};
});
// eslint-disable-next-line
let
render
=
new
dagreD3
.
render
();
let
nodeKeys
=
[];
...
...
@@ -76,23 +92,27 @@
};
// add input nodes
for
(
var
i
=
0
;
i
<
d
ata
[
'
input
'
].
length
;
++
i
)
{
let
curInputNode
=
d
ata
[
'
input
'
][
i
];
var
nodeKey
=
curInputNode
[
'
name
'
];
for
(
let
i
=
0
;
i
<
graphD
ata
[
'
input
'
].
length
;
++
i
)
{
let
curInputNode
=
graphD
ata
[
'
input
'
][
i
];
let
nodeKey
=
curInputNode
[
'
name
'
];
g
.
setNode
(
nodeKey
,
{
label
:
buildInputNodeLabel
(
curInputNode
),
class
:
'
input
'
,
style
:
'
stroke: #A3D39C; stroke-width: 3px;
'
+
'
stroke-dasharray: 5, 5;
'
,
labelStyle
:
'
font-size: 0.8em;
'
,
}
);
nodeKeys
.
push
(
nodeKey
);
}
// add operator nodes then add edges from inputs to operator and from operator to output
for
(
var
i
=
0
;
i
<
d
ata
[
'
node
'
].
length
;
++
i
)
{
let
curOperatorNode
=
d
ata
[
'
node
'
][
i
];
var
nodeKey
=
'
opNode_
'
+
i
;
for
(
let
i
=
0
;
i
<
graphD
ata
[
'
node
'
].
length
;
++
i
)
{
let
curOperatorNode
=
graphD
ata
[
'
node
'
][
i
];
let
nodeKey
=
'
opNode_
'
+
i
;
// add operator node
let
curOpLabel
=
curOperatorNode
[
'
opType
'
];
...
...
@@ -101,17 +121,25 @@
{
label
:
curOpLabel
+
'
'
.
repeat
(
Math
.
floor
(
curOpLabel
.
length
/
5
)),
class
:
'
operator
'
,
style
:
'
opacity: 0.5;
'
,
}
);
nodeKeys
.
push
(
nodeKey
);
// add output node
let
outputNodeKey
=
curOperatorNode
[
'
output
'
][
0
];
let
outputPadding
=
'
'
.
repeat
(
Math
.
floor
(
outputNodeKey
.
length
/
2
));
g
.
setNode
(
outputNodeKey
,
{
label
:
outputNodeKey
+
'
'
.
repeat
(
Math
.
floor
(
outputNodeKey
.
length
/
5
))
,
label
:
outputNodeKey
+
outputPadding
,
class
:
'
output
'
,
style
:
'
opacity: 0.5;
'
+
'
stroke-width: 2px;
'
+
'
stroke-dasharray: 5, 5;
'
,
shape
:
'
diamond
'
,
}
);
nodeKeys
.
push
(
outputNodeKey
);
...
...
@@ -134,14 +162,14 @@
svg
.
attr
(
'
viewBox
'
,
'
0 0
'
+
g
.
graph
().
width
+
'
'
+
g
.
graph
().
height
);
svg
.
selectAll
(
'
.node
'
).
on
(
'
click
'
,
function
(
d
,
i
)
{
this
.
curNode
=
g
.
node
(
d
);
let
nodeType
=
this
.
curNode
.
class
;
chartScope
.
curNode
=
g
.
node
(
d
);
let
nodeType
=
chartScope
.
curNode
.
class
;
let
nodeInfo
=
null
;
if
(
nodeType
===
'
operator
'
)
{
let
opIndex
=
d
.
slice
(
7
);
// remove prefix "opNode_"
nodeInfo
=
d
ata
.
node
[
opIndex
];
nodeInfo
=
graphD
ata
.
node
[
opIndex
];
}
else
if
(
nodeType
===
'
input
'
)
{
nodeInfo
=
d
ata
.
input
[
d
-
1
];
nodeInfo
=
graphD
ata
.
input
[
d
-
1
];
}
else
{
nodeInfo
=
'
output
'
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录