Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
0ab992b4
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
7
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0ab992b4
编写于
6月 30, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 30, 2020
浏览文件
操作
浏览文件
下载
差异文件
!401 Adding scalar single point judgment and optimize chart drawing logic
Merge pull request !401 from 王卫宁/wwn2
上级
143f8248
bcef2513
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
217 addition
and
105 deletion
+217
-105
mindinsight/ui/src/views/train-manage/scalar.vue
mindinsight/ui/src/views/train-manage/scalar.vue
+217
-105
未找到文件。
mindinsight/ui/src/views/train-manage/scalar.vue
浏览文件 @
0ab992b4
...
...
@@ -259,6 +259,7 @@ export default {
curBenchX
:
'
stepData
'
,
// Front axle reference
curAxisName
:
this
.
$t
(
'
scalar.step
'
),
// Current chart tip
axisBenchChangeTimer
:
null
,
// Horizontal axis reference switching timing
yAxisScaleTimer
:
null
,
// yAxis scale timer
compare
:
false
,
// Comparison Page
scalarCompare
:
this
.
$t
(
'
scalar
'
)[
'
comparison
'
],
abort
:
false
,
// charts that have not been drawn.
...
...
@@ -370,6 +371,10 @@ export default {
clearTimeout
(
this
.
axisBenchChangeTimer
);
this
.
axisBenchChangeTimer
=
null
;
}
if
(
this
.
yAxisScaleTimer
)
{
clearTimeout
(
this
.
yAxisScaleTimer
);
this
.
yAxisScaleTimer
=
null
;
}
},
mounted
()
{
if
(
!
this
.
$route
.
query
||
!
this
.
$route
.
query
.
train_id
)
{
...
...
@@ -576,6 +581,7 @@ export default {
if
(
!
res
||
!
res
.
data
||
!
res
.
data
.
metadatas
)
{
if
(
sampleObject
.
charObj
)
{
sampleObject
.
charObj
.
clear
();
sampleObject
.
onePoint
=
false
;
}
return
;
}
...
...
@@ -641,6 +647,15 @@ export default {
sampleObject
.
charData
.
charOption
=
this
.
formateCharOption
(
sampleIndex
,
);
const
tempOption
=
sampleObject
.
charData
.
charOption
;
if
(
tempOption
.
series
[
0
].
data
.
length
===
1
||
sampleObject
.
onePoint
)
{
tempOption
.
series
[
0
].
showSymbol
=
true
;
}
else
{
tempOption
.
series
[
0
].
showSymbol
=
false
;
}
this
.
$forceUpdate
();
...
...
@@ -648,41 +663,9 @@ export default {
if
(
sampleObject
.
charObj
)
{
sampleObject
.
charObj
.
hideLoading
();
}
// Draw chart
if
(
!
this
.
compare
)
{
this
.
updateOrCreateChar
(
sampleIndex
);
this
.
getCache
();
if
(
this
.
thresholdLocal
&&
this
.
thresholdLocal
[
this
.
decodeTrainingJobId
]
&&
this
.
thresholdLocal
[
this
.
decodeTrainingJobId
][
sampleObject
.
tagName
]
)
{
const
tempStorgeArr
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
thresholdLocal
[
this
.
decodeTrainingJobId
][
sampleObject
.
tagName
],
),
);
let
pieceStr
=
''
;
pieceStr
=
this
.
formatePieceStr
(
tempStorgeArr
);
sampleObject
.
pieceStr
=
pieceStr
;
tempStorgeArr
.
forEach
((
item
)
=>
{
item
.
color
=
this
.
thresholdColor
;
});
if
(
sampleObject
.
charObj
)
{
this
.
setVisualMap
(
sampleObject
,
tempStorgeArr
);
}
}
else
{
sampleObject
.
pieceStr
=
''
;
sampleObject
.
charData
.
charOption
.
series
[
0
].
markLine
=
false
;
}
this
.
updateOrCreateChar
(
sampleIndex
,
true
);
}
else
{
this
.
abort
=
true
;
}
...
...
@@ -696,6 +679,99 @@ export default {
});
},
/**
* set one point style
* @param {Object} sampleObject
*/
setOnePoint
(
sampleObject
)
{
const
that
=
this
;
sampleObject
.
charObj
.
on
(
'
datazoom
'
,
function
(
params
)
{
const
xAxisObject
=
params
.
batch
[
0
];
const
yAxisObject
=
params
.
batch
[
1
];
const
charData
=
sampleObject
.
charData
.
charOption
.
series
[
0
].
data
;
const
tempCharOption
=
sampleObject
.
charData
.
charOption
;
// one point
if
(
charData
.
length
===
1
)
{
sampleObject
.
onePoint
=
true
;
tempCharOption
.
series
[
0
].
showSymbol
=
true
;
sampleObject
.
charObj
.
setOption
(
tempCharOption
,
false
);
return
;
}
let
filtetArr
=
[];
for
(
let
i
=
0
;
i
<
charData
.
length
;
i
++
)
{
if
(
Math
.
ceil
(
charData
[
i
][
0
]
*
10000
)
/
10000
>=
xAxisObject
.
startValue
&&
Math
.
floor
(
charData
[
i
][
0
]
*
10000
)
/
10000
<=
xAxisObject
.
endValue
&&
Math
.
ceil
(
charData
[
i
][
1
]
*
10000
)
/
10000
>=
yAxisObject
.
startValue
&&
Math
.
floor
(
charData
[
i
][
1
]
*
10000
)
/
10000
<=
yAxisObject
.
endValue
)
{
filtetArr
.
push
(
charData
[
i
]);
if
(
filtetArr
.
length
>
1
)
{
filtetArr
=
[];
break
;
}
}
}
if
(
filtetArr
.
length
===
1
)
{
sampleObject
.
onePoint
=
true
;
tempCharOption
.
series
[
0
].
showSymbol
=
true
;
}
else
{
sampleObject
.
onePoint
=
false
;
tempCharOption
.
series
[
0
].
showSymbol
=
false
;
}
if
(
tempCharOption
.
visualMap
&&
tempCharOption
.
visualMap
[
'
pieces
'
]
&&
tempCharOption
.
visualMap
[
'
pieces
'
].
length
>
0
)
{
tempCharOption
.
visualMap
=
null
;
tempCharOption
.
series
[
0
].
markLine
=
null
;
that
.
updateVisualMap
(
sampleObject
);
}
else
{
sampleObject
.
charObj
.
setOption
(
tempCharOption
,
false
);
}
});
},
/**
* set restore
* @param {Object} sampleObject
*/
setRestore
(
sampleObject
)
{
const
that
=
this
;
sampleObject
.
charObj
.
on
(
'
restore
'
,
function
(
params
)
{
const
charData
=
sampleObject
.
charData
.
charOption
.
series
[
0
].
data
;
const
tempCharOption
=
sampleObject
.
charData
.
charOption
;
// one point
if
(
charData
.
length
===
1
)
{
sampleObject
.
onePoint
=
true
;
tempCharOption
.
series
[
0
].
showSymbol
=
true
;
sampleObject
.
charObj
.
setOption
(
tempCharOption
,
false
);
return
;
}
sampleObject
.
onePoint
=
false
;
tempCharOption
.
series
[
0
].
showSymbol
=
false
;
if
(
tempCharOption
.
visualMap
&&
tempCharOption
.
visualMap
[
'
pieces
'
]
&&
tempCharOption
.
visualMap
[
'
pieces
'
].
length
>
0
)
{
tempCharOption
.
visualMap
=
null
;
tempCharOption
.
series
[
0
].
markLine
=
null
;
that
.
updateVisualMap
(
sampleObject
);
}
else
{
sampleObject
.
charObj
.
setOption
(
tempCharOption
,
false
);
}
});
},
/**
* Formatting Chart Data
* @param {Number} sampleIndex Chart subscript
...
...
@@ -822,7 +898,6 @@ export default {
width
:
2
,
},
},
axisLabel
:
{
color
:
'
#9EA4B3
'
,
formatter
(
value
)
{
...
...
@@ -968,7 +1043,8 @@ export default {
strBody
+=
`<tr><td style="border-radius:50%;width:15px;height:15px;vertical-align: middle;`
+
`margin-right: 5px;background-color:
${
parma
.
color
===
that
.
thresholdColor
parma
.
color
===
that
.
thresholdColor
&&
sampleObject
.
charData
.
charOption
.
visualMap
?
that
.
thresholdColor
:
sampleObject
.
colors
}
;`
+
...
...
@@ -1053,13 +1129,47 @@ export default {
return
tempOption
;
},
/**
* update visualMap
* @param {Object} sampleObject
*/
updateVisualMap
(
sampleObject
)
{
this
.
getCache
();
if
(
this
.
thresholdLocal
&&
this
.
thresholdLocal
[
this
.
decodeTrainingJobId
]
&&
this
.
thresholdLocal
[
this
.
decodeTrainingJobId
][
sampleObject
.
tagName
]
)
{
const
tempStorgeArr
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
thresholdLocal
[
this
.
decodeTrainingJobId
][
sampleObject
.
tagName
],
),
);
let
pieceStr
=
''
;
pieceStr
=
this
.
formatePieceStr
(
tempStorgeArr
);
sampleObject
.
pieceStr
=
pieceStr
;
tempStorgeArr
.
forEach
((
item
)
=>
{
item
.
color
=
this
.
thresholdColor
;
});
if
(
sampleObject
.
charObj
)
{
this
.
setVisualMap
(
sampleObject
,
tempStorgeArr
);
}
}
else
{
sampleObject
.
pieceStr
=
''
;
sampleObject
.
charData
.
charOption
.
series
[
0
].
markLine
=
null
;
}
},
/**
* Updating or Creating a Specified chart
* @param {Number} sampleIndex Chart subscript
* @param {Boole
n} resetAnimate restart the animation
* @param {Boole
an} isSetVisualMap isSetVisualMap
*/
updateOrCreateChar
(
sampleIndex
,
resetAnimate
)
{
updateOrCreateChar
(
sampleIndex
,
isSetVisualMap
)
{
const
sampleObject
=
this
.
originDataArr
[
sampleIndex
];
if
(
!
sampleObject
)
{
return
;
...
...
@@ -1081,11 +1191,11 @@ export default {
null
,
);
sampleObject
.
charObj
.
setOption
(
sampleObject
.
charData
.
charOption
,
true
);
this
.
setOnePoint
(
sampleObject
);
this
.
setRestore
(
sampleObject
);
}
// if run's display reopen the animation
if
(
resetAnimate
)
{
sampleObject
.
charData
.
charOption
.
animation
=
true
;
if
(
isSetVisualMap
)
{
this
.
updateVisualMap
(
sampleObject
);
}
},
...
...
@@ -1206,6 +1316,14 @@ export default {
this
.
isActive
===
2
?
0
:
90
;
sampleObject
.
updateFlag
=
true
;
sampleObject
.
charObj
.
clear
();
if
(
sampleObject
.
charData
.
charOption
.
series
[
0
].
data
.
length
===
1
)
{
sampleObject
.
charData
.
charOption
.
series
[
0
].
showSymbol
=
true
;
sampleObject
.
onePoint
=
true
;
}
else
{
sampleObject
.
charData
.
charOption
.
series
[
0
].
showSymbol
=
false
;
sampleObject
.
onePoint
=
false
;
}
this
.
updateOrCreateChar
(
sampleObject
.
sampleIndex
);
}
});
...
...
@@ -1633,80 +1751,75 @@ export default {
*/
yAxisScale
(
sampleIndex
)
{
if
(
this
.
isTimeReload
)
{
this
.
autoUpdateSamples
();
}
if
(
this
.
yAxisScaleTimer
)
{
clearTimeout
(
this
.
yAxisScaleTimer
);
this
.
yAxisScaleTimer
=
null
;
}
const
sampleObject
=
this
.
originDataArr
[
sampleIndex
];
if
(
!
sampleObject
)
{
return
;
}
const
log
=
!
sampleObject
.
log
;
if
(
log
)
{
sampleObject
.
charData
.
charOption
.
toolbox
.
feature
.
myTool2
.
iconStyle
.
borderColor
=
'
#3E98C5
'
;
sampleObject
.
charData
.
charOption
.
yAxis
.
type
=
'
log
'
;
}
else
{
sampleObject
.
charData
.
charOption
.
yAxis
.
type
=
'
value
'
;
sampleObject
.
charData
.
charOption
.
toolbox
.
feature
.
myTool2
.
iconStyle
.
borderColor
=
'
#666
'
;
}
sampleObject
.
charData
.
oriData
.
forEach
((
originData
,
index
)
=>
{
this
.
yAxisScaleTimer
=
setTimeout
(()
=>
{
const
log
=
!
sampleObject
.
log
;
if
(
log
)
{
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
].
data
=
this
.
formateSmoothData
(
sampleObject
.
charData
.
oriData
[
index
].
logData
[
this
.
curBenchX
],
);
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
+
1
].
data
=
sampleObject
.
charData
.
oriData
[
index
].
logData
[
this
.
curBenchX
];
sampleObject
.
charData
.
charOption
.
toolbox
.
feature
.
myTool2
.
iconStyle
.
borderColor
=
'
#3E98C5
'
;
sampleObject
.
charData
.
charOption
.
yAxis
.
type
=
'
log
'
;
}
else
{
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
].
data
=
this
.
formateSmoothData
(
sampleObject
.
charData
.
oriData
[
index
].
valueData
[
this
.
curBenchX
],
);
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
+
1
].
data
=
sampleObject
.
charData
.
oriData
[
index
].
valueData
[
this
.
curBenchX
];
sampleObject
.
charData
.
charOption
.
yAxis
.
type
=
'
value
'
;
sampleObject
.
charData
.
charOption
.
toolbox
.
feature
.
myTool2
.
iconStyle
.
borderColor
=
'
#666
'
;
}
});
sampleObject
.
log
=
log
;
sampleObject
.
updateFlag
=
true
;
sampleObject
.
charObj
.
clear
();
sampleObject
.
charData
.
oriData
.
forEach
((
originData
,
index
)
=>
{
if
(
log
)
{
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
].
data
=
this
.
formateSmoothData
(
sampleObject
.
charData
.
oriData
[
index
].
logData
[
this
.
curBenchX
],
);
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
+
1
].
data
=
sampleObject
.
charData
.
oriData
[
index
].
logData
[
this
.
curBenchX
];
}
else
{
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
].
data
=
this
.
formateSmoothData
(
sampleObject
.
charData
.
oriData
[
index
].
valueData
[
this
.
curBenchX
],
);
sampleObject
.
charData
.
charOption
.
series
[
index
*
2
+
1
].
data
=
sampleObject
.
charData
.
oriData
[
index
].
valueData
[
this
.
curBenchX
];
}
});
sampleObject
.
log
=
log
;
sampleObject
.
updateFlag
=
true
;
sampleObject
.
charObj
.
clear
();
const
tempOption
=
sampleObject
.
charData
.
charOption
;
if
(
tempOption
.
visualMap
&&
tempOption
.
visualMap
[
'
pieces
'
]
&&
tempOption
.
visualMap
[
'
pieces
'
].
length
>
0
)
{
tempOption
.
visualMap
=
null
;
tempOption
.
series
[
0
].
markLine
=
null
;
sampleObject
.
charObj
.
setOption
(
tempOption
,
true
);
const
tempOption
=
sampleObject
.
charData
.
charOption
;
const
dataObj
=
tempOption
.
series
[
0
];
this
.
getCache
();
// one point
if
(
dataObj
.
data
.
length
===
1
)
{
tempOption
.
series
[
0
].
showSymbol
=
true
;
sampleObject
.
onePoint
=
true
;
}
else
{
tempOption
.
series
[
0
].
showSymbol
=
false
;
sampleObject
.
onePoint
=
false
;
}
if
(
t
his
.
thresholdLocal
&&
t
his
.
thresholdLocal
[
this
.
decodeTrainingJobId
]
&&
t
his
.
thresholdLocal
[
this
.
decodeTrainingJobId
][
sampleObject
.
tagName
]
t
empOption
.
visualMap
&&
t
empOption
.
visualMap
[
'
pieces
'
]
&&
t
empOption
.
visualMap
[
'
pieces
'
].
length
>
0
)
{
const
tempStorgeArr
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
thresholdLocal
[
this
.
decodeTrainingJobId
][
sampleObject
.
tagName
],
),
);
tempStorgeArr
.
forEach
((
item
)
=>
{
item
.
color
=
this
.
thresholdColor
;
});
if
(
sampleObject
.
charObj
)
{
this
.
setVisualMap
(
sampleObject
,
tempStorgeArr
);
}
tempOption
.
visualMap
=
null
;
tempOption
.
series
[
0
].
markLine
=
null
;
sampleObject
.
charObj
.
setOption
(
tempOption
,
true
);
this
.
updateVisualMap
(
sampleObject
);
}
else
{
sampleObject
.
pieceStr
=
''
;
sampleObject
.
charData
.
charOption
.
series
[
0
].
markLine
=
false
;
this
.
updateOrCreateChar
(
sampleIndex
);
}
}
else
{
this
.
updateOrCreateChar
(
sampleIndex
);
}
},
500
);
},
/**
...
...
@@ -1814,13 +1927,12 @@ export default {
)
{
tempCharOption
.
visualMap
=
null
;
tempCharOption
.
series
[
0
].
markLine
=
null
;
tempCharOption
.
series
[
0
].
lineStyle
.
color
=
sampleItem
.
colors
;
tempCharOption
.
series
[
0
].
lineStyle
[
'
color
'
]
=
sampleItem
.
colors
;
}
sampleItem
.
charObj
.
setOption
(
tempCharOption
,
tru
e
);
sampleItem
.
charObj
.
setOption
(
tempCharOption
,
fals
e
);
if
(
this
.
isTimeReload
)
{
this
.
autoUpdateSamples
();
}
this
.
$forceUpdate
();
})
.
catch
(()
=>
{
if
(
this
.
isTimeReload
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录