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 @@
<div
class=
"visual-dl-page-container"
>
<div
class=
"visual-dl-page-left"
>
<ui-chart
:fit-screen=
"fitScreen"
:download=
"download"
:scale=
"config.scale"
:do-download=
"doDownload"
:cur-node=
"curNode"
@
curNodeUpdated=
"curNode = $event"
@
triggerDownload=
"doDownload = $event"
/>
</div>
<div
class=
"visual-dl-page-right"
>
<div
class=
"visual-dl-page-config-container"
>
<ui-config
:config=
"config"
:cur-node=
"curNode"
@
fitScreen=
"handleFitScreen
"
@
download=
"handleDownload
"
:do-download=
"doDownload
"
@
triggerDownload=
"doDownload = $event
"
/>
</div>
</div>
...
...
@@ -36,26 +34,14 @@ export default {
name
:
'
Graph
'
,
data
()
{
return
{
config
:
{
scale
:
0.5
,
},
fitScreen
:
{
fitScreen
:
false
},
download
:
{
download
:
false
},
doDownload
:
false
,
curNode
:
{},
};
},
mounted
()
{
autoAdjustHeight
();
},
methods
:
{
handleFitScreen
()
{
this
.
fitScreen
=
{
fitScreen
:
true
};
this
.
config
.
scale
=
0.5
;
},
handleDownload
()
{
this
.
download
=
{
fitScreen
:
true
};
},
},
methods
:
{},
};
</
script
>
...
...
frontend/src/graph/ui/Chart.vue
浏览文件 @
8758370d
<
template
>
<div
class=
"visual-dl-graph-charts"
>
<svg
class=
"visual-dl-page-left"
>
<svg
class=
"visual-dl-page-left"
ref=
"graphSvg"
>
<g/>
</svg>
</div>
</
template
>
<
script
>
// libs
import
echarts
from
'
echarts
'
;
import
{
dragMovelHandler
,
tansformElement
,
relativeMove
,
}
from
'
./dragHelper
'
;
// service
import
{
getPluginGraphsGraph
}
from
'
../../service
'
;
// https://github.com/taye/interact.js
import
interact
from
'
interactjs
'
;
// for d3 drawing
import
*
as
d3
from
'
d3
'
;
export
default
{
props
:
{
'
fitScreen
'
:
{
type
:
Function
,
required
:
true
,
},
'
download
'
:
{
type
:
Function
,
'
doDownload
'
:
{
type
:
Boolean
,
required
:
true
,
},
'
scale
'
:
{
type
:
Number
,
default
:
1
,
},
'
curNode
'
:
{
type
:
Object
,
default
:
{},
}},
computed
:
{
computedWidth
()
{
let
scale
=
this
.
scale
;
return
Math
.
floor
(
scale
*
2
*
700
);
},
},
computed
:
{},
data
()
{
return
{
myCY
:
null
,
graphUrl
:
''
,
};
},
watch
:
{
fitScreen
:
function
(
val
)
{
this
.
clearDragedTransform
(
this
.
getBigImgEl
());
this
.
clearDragedTransform
(
this
.
getSmallImgDragHandler
());
},
download
:
function
(
val
)
{
if
(
this
.
myCY
)
{
let
aEl
=
document
.
createElement
(
'
a
'
);
aEl
.
href
=
this
.
myCY
.
png
();
aEl
.
download
=
'
graph.png
'
;
aEl
.
click
();
doDownload
:
function
(
val
)
{
if
(
this
.
doDownload
)
{
// TODO(daming-lu): .svg is ugly and colorless.
let
svg
=
this
.
$refs
.
graphSvg
;
// get svg source.
let
serializer
=
new
XMLSerializer
();
let
source
=
serializer
.
serializeToString
(
svg
);
// 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
()
{
this
.
getOriginChartsData
();
let
chartScope
=
this
;
getPluginGraphsGraph
().
then
(({
errno
,
data
})
=>
{
let
graphData
=
data
.
data
;
...
...
@@ -183,94 +179,7 @@ export default {
});
},
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
);
});
},
});
},
},
methods
:
{},
};
</
script
>
<
style
lang=
"stylus"
>
...
...
frontend/src/graph/ui/Config.vue
浏览文件 @
8758370d
<
template
>
<div
class=
"visual-dl-graph-config-com"
>
<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
class=
"visual-dl-graph-config-button"
color=
"primary"
...
...
@@ -20,14 +9,6 @@
<v-icon
style=
"margin-right: 6px"
>
file_download
</v-icon>
Download image
</v-btn>
<v-slider
label=
"Scale"
max=
"1"
min=
"0.1"
step=
"0.1"
v-model=
"config.scale"
dark
/>
</div>
<div
class=
"node-info"
>
<h3>
Node Info:
</h3>
...
...
@@ -55,21 +36,16 @@
export
default
{
props
:
{
curNode
:
{
type
:
Object
,
'
doDownload
'
:
{
type
:
Boolean
,
required
:
true
,
},
config
:
{
'
curNode
'
:
{
type
:
Object
,
required
:
true
,
},
},
methods
:
{
handleFitScreen
()
{
this
.
$emit
(
'
fitScreen
'
);
},
default
:
{},
}},
methods
:
{
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录