Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
8758370d
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
88
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看板
未验证
提交
8758370d
编写于
4月 06, 2018
作者:
D
daminglu
提交者:
GitHub
4月 06, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed Fit-to-Screen and Slider as we do not need them anymore (#370)
上级
0be5b06c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
49 addition
and
178 deletion
+49
-178
frontend/src/graph/Graph.vue
frontend/src/graph/Graph.vue
+6
-20
frontend/src/graph/ui/Chart.vue
frontend/src/graph/ui/Chart.vue
+37
-128
frontend/src/graph/ui/Config.vue
frontend/src/graph/ui/Config.vue
+6
-30
未找到文件。
frontend/src/graph/Graph.vue
浏览文件 @
8758370d
...
@@ -2,20 +2,18 @@
...
@@ -2,20 +2,18 @@
<div
class=
"visual-dl-page-container"
>
<div
class=
"visual-dl-page-container"
>
<div
class=
"visual-dl-page-left"
>
<div
class=
"visual-dl-page-left"
>
<ui-chart
<ui-chart
:fit-screen=
"fitScreen"
:do-download=
"doDownload"
:download=
"download"
:scale=
"config.scale"
:cur-node=
"curNode"
:cur-node=
"curNode"
@
curNodeUpdated=
"curNode = $event"
@
curNodeUpdated=
"curNode = $event"
@
triggerDownload=
"doDownload = $event"
/>
/>
</div>
</div>
<div
class=
"visual-dl-page-right"
>
<div
class=
"visual-dl-page-right"
>
<div
class=
"visual-dl-page-config-container"
>
<div
class=
"visual-dl-page-config-container"
>
<ui-config
<ui-config
:config=
"config"
:cur-node=
"curNode"
:cur-node=
"curNode"
@
fitScreen=
"handleFitScreen
"
:do-download=
"doDownload
"
@
download=
"handleDownload
"
@
triggerDownload=
"doDownload = $event
"
/>
/>
</div>
</div>
</div>
</div>
...
@@ -36,26 +34,14 @@ export default {
...
@@ -36,26 +34,14 @@ export default {
name
:
'
Graph
'
,
name
:
'
Graph
'
,
data
()
{
data
()
{
return
{
return
{
config
:
{
doDownload
:
false
,
scale
:
0.5
,
},
fitScreen
:
{
fitScreen
:
false
},
download
:
{
download
:
false
},
curNode
:
{},
curNode
:
{},
};
};
},
},
mounted
()
{
mounted
()
{
autoAdjustHeight
();
autoAdjustHeight
();
},
},
methods
:
{
methods
:
{},
handleFitScreen
()
{
this
.
fitScreen
=
{
fitScreen
:
true
};
this
.
config
.
scale
=
0.5
;
},
handleDownload
()
{
this
.
download
=
{
fitScreen
:
true
};
},
},
};
};
</
script
>
</
script
>
...
...
frontend/src/graph/ui/Chart.vue
浏览文件 @
8758370d
<
template
>
<
template
>
<div
class=
"visual-dl-graph-charts"
>
<div
class=
"visual-dl-graph-charts"
>
<svg
class=
"visual-dl-page-left"
>
<svg
class=
"visual-dl-page-left"
ref=
"graphSvg"
>
<g/>
<g/>
</svg>
</svg>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
// libs
import
echarts
from
'
echarts
'
;
import
{
dragMovelHandler
,
tansformElement
,
relativeMove
,
}
from
'
./dragHelper
'
;
// service
// service
import
{
getPluginGraphsGraph
}
from
'
../../service
'
;
import
{
getPluginGraphsGraph
}
from
'
../../service
'
;
// https://github.com/taye/interact.js
import
interact
from
'
interactjs
'
;
// for d3 drawing
// for d3 drawing
import
*
as
d3
from
'
d3
'
;
import
*
as
d3
from
'
d3
'
;
export
default
{
export
default
{
props
:
{
props
:
{
'
fitScreen
'
:
{
'
doDownload
'
:
{
type
:
Function
,
type
:
Boolean
,
required
:
true
,
},
'
download
'
:
{
type
:
Function
,
required
:
true
,
required
:
true
,
},
},
'
scale
'
:
{
type
:
Number
,
default
:
1
,
},
'
curNode
'
:
{
'
curNode
'
:
{
type
:
Object
,
type
:
Object
,
default
:
{},
default
:
{},
}},
}},
computed
:
{
computed
:
{},
computedWidth
()
{
let
scale
=
this
.
scale
;
return
Math
.
floor
(
scale
*
2
*
700
);
},
},
data
()
{
data
()
{
return
{
return
{
myCY
:
null
,
graphUrl
:
''
,
};
};
},
},
watch
:
{
watch
:
{
fitScreen
:
function
(
val
)
{
doDownload
:
function
(
val
)
{
this
.
clearDragedTransform
(
this
.
getBigImgEl
());
if
(
this
.
doDownload
)
{
this
.
clearDragedTransform
(
this
.
getSmallImgDragHandler
());
// TODO(daming-lu): .svg is ugly and colorless.
},
let
svg
=
this
.
$refs
.
graphSvg
;
download
:
function
(
val
)
{
if
(
this
.
myCY
)
{
// get svg source.
let
aEl
=
document
.
createElement
(
'
a
'
);
let
serializer
=
new
XMLSerializer
();
aEl
.
href
=
this
.
myCY
.
png
();
let
source
=
serializer
.
serializeToString
(
svg
);
aEl
.
download
=
'
graph.png
'
;
aEl
.
click
();
// add name spaces.
if
(
!
source
.
match
(
/^<svg
[^
>
]
+xmlns="http
\:\/\/
www
\.
w3
\.
org
\/
2000
\/
svg"/
))
{
source
=
source
.
replace
(
/^<svg/
,
'
<svg xmlns="http://www.w3.org/2000/svg"
'
);
}
if
(
!
source
.
match
(
/^<svg
[^
>
]
+"http
\:\/\/
www
\.
w3
\.
org
\/
1999
\/
xlink"/
))
{
source
=
source
.
replace
(
/^<svg/
,
'
<svg xmlns:xlink="http://www.w3.org/1999/xlink"
'
);
}
// add xml declaration
source
=
'
<?xml version="1.0" standalone="no"?>
\r\n
'
+
source
;
// convert svg source to URI data scheme.
let
url
=
'
data:image/svg+xml;charset=utf-8,
'
+
encodeURIComponent
(
source
);
let
a
=
document
.
createElement
(
'
a
'
);
a
.
download
=
'
graph.svg
'
;
a
.
href
=
url
;
a
.
click
();
this
.
$emit
(
'
triggerDownload
'
,
false
);
}
}
},
},
},
},
mounted
()
{
mounted
()
{
this
.
getOriginChartsData
();
let
chartScope
=
this
;
let
chartScope
=
this
;
getPluginGraphsGraph
().
then
(({
errno
,
data
})
=>
{
getPluginGraphsGraph
().
then
(({
errno
,
data
})
=>
{
let
graphData
=
data
.
data
;
let
graphData
=
data
.
data
;
...
@@ -183,94 +179,7 @@ export default {
...
@@ -183,94 +179,7 @@ export default {
});
});
},
},
methods
:
{
methods
:
{},
createChart
()
{
let
el
=
this
.
el
.
getElementsByClassName
(
'
visual-dl-chart-box
'
)[
0
];
this
.
myChart
=
echarts
.
init
(
el
);
},
initChartOption
(
data
)
{
this
.
setChartOptions
(
data
);
},
setChartOptions
(
data
)
{
this
.
myChart
.
setOption
(
data
);
},
getOriginChartsData
()
{
getPluginGraphsGraph
().
then
(({
status
,
data
})
=>
{
if
(
status
===
0
&&
data
.
url
)
{
this
.
graphUrl
=
data
.
url
;
this
.
addDragEventForImg
();
}
});
},
clearDragedTransform
(
dragImgEl
)
{
dragImgEl
.
style
.
transform
=
'
none
'
;
dragImgEl
.
setAttribute
(
'
data-x
'
,
0
);
dragImgEl
.
setAttribute
(
'
data-y
'
,
0
);
},
getBigImgEl
()
{
return
this
.
$refs
.
draggable
;
},
getSmallImgEl
()
{
return
this
.
$refs
.
small_img
;
},
getSmallImgDragHandler
()
{
return
this
.
$refs
.
screen_handler
;
},
addDragEventForImg
()
{
let
chartScope
=
this
;
// target elements with the "draggable" class
interact
(
'
.draggable
'
).
draggable
({
// enable inertial throwing
inertia
:
true
,
autoScroll
:
true
,
// call this function on every dragmove event
onmove
(
event
)
{
dragMovelHandler
(
event
,
(
target
,
x
,
y
)
=>
{
tansformElement
(
target
,
x
,
y
);
// compute the proportional value
let
triggerEl
=
chartScope
.
getBigImgEl
();
let
relativeEl
=
chartScope
.
getSmallImgDragHandler
();
relativeMove
({
triggerEl
,
x
,
y
},
relativeEl
);
});
},
});
interact
(
'
.screen-handler
'
).
draggable
({
// enable inertial throwing
inertia
:
true
,
autoScroll
:
true
,
restrict
:
{
restriction
:
'
parent
'
,
endOnly
:
false
,
elementRect
:
{
top
:
0
,
left
:
0
,
bottom
:
1
,
right
:
1
,
},
},
// call this function on every dragmove event
onmove
(
event
)
{
dragMovelHandler
(
event
,
(
target
,
x
,
y
)
=>
{
tansformElement
(
target
,
x
,
y
);
// compute the proportional value
let
triggerEl
=
chartScope
.
getSmallImgEl
();
let
relativeEl
=
chartScope
.
getBigImgEl
();
relativeMove
({
triggerEl
,
x
,
y
},
relativeEl
);
});
},
});
},
},
};
};
</
script
>
</
script
>
<
style
lang=
"stylus"
>
<
style
lang=
"stylus"
>
...
...
frontend/src/graph/ui/Config.vue
浏览文件 @
8758370d
<
template
>
<
template
>
<div
class=
"visual-dl-graph-config-com"
>
<div
class=
"visual-dl-graph-config-com"
>
<div
class=
"graph-config-upper"
>
<div
class=
"graph-config-upper"
>
<v-btn
class=
"visual-dl-graph-config-button"
color=
"primary"
@
click=
"handleFitScreen"
dark
>
<v-icon
style=
"margin-right: 6px"
size=
"20"
>
fullscreen
</v-icon>
Fit
to
screen
</v-btn>
<v-btn
<v-btn
class=
"visual-dl-graph-config-button"
class=
"visual-dl-graph-config-button"
color=
"primary"
color=
"primary"
...
@@ -20,14 +9,6 @@
...
@@ -20,14 +9,6 @@
<v-icon
style=
"margin-right: 6px"
>
file_download
</v-icon>
<v-icon
style=
"margin-right: 6px"
>
file_download
</v-icon>
Download image
Download image
</v-btn>
</v-btn>
<v-slider
label=
"Scale"
max=
"1"
min=
"0.1"
step=
"0.1"
v-model=
"config.scale"
dark
/>
</div>
</div>
<div
class=
"node-info"
>
<div
class=
"node-info"
>
<h3>
Node Info:
</h3>
<h3>
Node Info:
</h3>
...
@@ -55,21 +36,16 @@
...
@@ -55,21 +36,16 @@
export
default
{
export
default
{
props
:
{
props
:
{
curNode
:
{
'
doDownload
'
:
{
type
:
Object
,
type
:
Boolean
,
required
:
true
,
required
:
true
,
},
},
config
:
{
'
curNode
'
:
{
type
:
Object
,
type
:
Object
,
required
:
true
,
default
:
{},
},
}},
methods
:
{
},
methods
:
{
handleFitScreen
()
{
this
.
$emit
(
'
fitScreen
'
);
},
handleDownload
()
{
handleDownload
()
{
this
.
$emit
(
'
download
'
);
this
.
$emit
(
'
triggerDownload
'
,
true
);
},
},
},
},
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录