Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
e58ed6a4
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
8
Star
4
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看板
提交
e58ed6a4
编写于
6月 23, 2020
作者:
W
wwx691809
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify input threshold verification and Optimizing the visual map component of echart rendering
上级
7f2d7f02
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
182 addition
and
79 deletion
+182
-79
mindinsight/ui/src/views/train-manage/scalar.vue
mindinsight/ui/src/views/train-manage/scalar.vue
+182
-79
未找到文件。
mindinsight/ui/src/views/train-manage/scalar.vue
浏览文件 @
e58ed6a4
...
@@ -92,7 +92,8 @@ limitations under the License.
...
@@ -92,7 +92,8 @@ limitations under the License.
</div>
</div>
<div
class=
"chartThreshold"
>
<div
class=
"chartThreshold"
>
<div
class=
"chartThresholdLeft"
>
{{
$t
(
"
scalar.currentThreshold
"
)
}}
:
{{
sampleItem
.
pieceStr
||
"
-
"
}}
</div>
<div
class=
"chartThresholdLeft"
:title=
"sampleItem.pieceStr"
>
{{
$t
(
"
scalar.currentThreshold
"
)
}}
:
{{
sampleItem
.
pieceStr
||
"
-
"
}}
</div>
<div
class=
"chartThresholdRight"
>
<div
class=
"chartThresholdRight"
>
<span
@
click=
"setThreshold(sampleItem)"
<span
@
click=
"setThreshold(sampleItem)"
v-if=
"!thresholdLocal
v-if=
"!thresholdLocal
...
@@ -1104,21 +1105,8 @@ export default {
...
@@ -1104,21 +1105,8 @@ export default {
restore
:
{},
restore
:
{},
},
},
},
},
visualMap
:
{
show
:
false
,
pieces
:
piecesData
,
outOfRange
:
{
color
:
sampleObject
.
colors
,
},
},
series
:
seriesData
,
series
:
seriesData
,
};
};
if
(
tempOption
.
visualMap
.
pieces
.
length
>
0
)
{
tempOption
.
series
.
forEach
((
item
)
=>
{
item
.
lineStyle
.
color
=
null
;
});
}
return
tempOption
;
return
tempOption
;
},
},
...
@@ -1793,6 +1781,7 @@ export default {
...
@@ -1793,6 +1781,7 @@ export default {
*/
*/
setThreshold
(
sampleItem
)
{
setThreshold
(
sampleItem
)
{
this
.
stopUpdateSamples
();
this
.
getCache
();
this
.
getCache
();
if
(
if
(
this
.
thresholdLocal
&&
this
.
thresholdLocal
&&
...
@@ -1889,7 +1878,10 @@ export default {
...
@@ -1889,7 +1878,10 @@ export default {
}
else
if
(
isNaN
(
valueFirst
)
||
isNaN
(
valueSec
))
{
}
else
if
(
isNaN
(
valueFirst
)
||
isNaN
(
valueSec
))
{
this
.
thresholdErrorMsg
=
this
.
$t
(
'
scalar.placeHolderNumber
'
);
this
.
thresholdErrorMsg
=
this
.
$t
(
'
scalar.placeHolderNumber
'
);
isValidate
=
false
;
isValidate
=
false
;
}
else
if
(
valueFirst
.
indexOf
(
'
Infinity
'
)
>
-
1
||
valueSec
.
indexOf
(
'
Infinity
'
)
>
-
1
)
{
}
else
if
(
valueFirst
.
indexOf
(
'
Infinity
'
)
>
-
1
||
valueSec
.
indexOf
(
'
Infinity
'
)
>
-
1
)
{
this
.
thresholdErrorMsg
=
this
.
$t
(
'
scalar.placeHolderNumber
'
);
this
.
thresholdErrorMsg
=
this
.
$t
(
'
scalar.placeHolderNumber
'
);
isValidate
=
false
;
isValidate
=
false
;
}
else
{
}
else
{
...
@@ -1928,6 +1920,175 @@ export default {
...
@@ -1928,6 +1920,175 @@ export default {
return
isValidate
;
return
isValidate
;
},
},
/**
* set visualMap
* @param {Object} sampleObject sampleObject
* @param {Array} chartPieces chartPieces
*/
setVisualMap
(
sampleObject
,
chartPieces
)
{
if
(
chartPieces
.
length
===
0
)
{
return
;
}
const
markLineData
=
[];
chartPieces
.
forEach
((
item
)
=>
{
if
(
item
.
lt
||
item
.
lt
===
0
)
{
const
markLineDataItem
=
{};
markLineDataItem
.
yAxis
=
item
.
lt
;
markLineData
.
push
(
markLineDataItem
);
}
if
(
item
.
gt
||
item
.
gt
===
0
)
{
const
markLineDataItem
=
{};
markLineDataItem
.
yAxis
=
item
.
gt
;
markLineData
.
push
(
markLineDataItem
);
}
});
const
tempCharOption
=
sampleObject
.
charData
.
charOption
;
let
chartPiecesTemp
=
JSON
.
parse
(
JSON
.
stringify
(
chartPieces
));
chartPiecesTemp
.
forEach
((
item
)
=>
{
item
.
color
=
this
.
thresholdColor
;
});
if
(
chartPiecesTemp
.
length
===
1
)
{
if
(
!
isNaN
(
chartPiecesTemp
[
0
][
'
lt
'
])
&&
isNaN
(
chartPiecesTemp
[
0
][
'
gt
'
])
)
{
if
(
chartPiecesTemp
[
0
][
'
lt
'
]
<=
sampleObject
.
zoomData
[
0
])
{
chartPiecesTemp
=
[];
}
else
if
(
chartPiecesTemp
[
0
][
'
lt
'
]
<
sampleObject
.
zoomData
[
1
]
&&
chartPiecesTemp
[
0
][
'
lt
'
]
>
sampleObject
.
zoomData
[
0
]
)
{
chartPiecesTemp
[
0
][
'
gt
'
]
=
sampleObject
.
zoomData
[
0
];
}
else
if
(
chartPiecesTemp
[
0
][
'
lt
'
]
>=
sampleObject
.
zoomData
[
1
])
{
chartPiecesTemp
[
0
][
'
lt
'
]
=
sampleObject
.
zoomData
[
1
];
chartPiecesTemp
[
0
][
'
gt
'
]
=
sampleObject
.
zoomData
[
0
];
}
}
else
if
(
!
isNaN
(
chartPiecesTemp
[
0
][
'
gt
'
])
&&
isNaN
(
chartPiecesTemp
[
0
][
'
lt
'
])
)
{
if
(
chartPiecesTemp
[
0
][
'
gt
'
]
>=
sampleObject
.
zoomData
[
1
])
{
chartPiecesTemp
=
[];
}
else
if
(
chartPiecesTemp
[
0
][
'
gt
'
]
>
sampleObject
.
zoomData
[
0
]
&&
chartPiecesTemp
[
0
][
'
gt
'
]
<
sampleObject
.
zoomData
[
1
]
)
{
chartPiecesTemp
[
0
][
'
lt
'
]
=
sampleObject
.
zoomData
[
1
];
}
else
if
(
chartPiecesTemp
[
0
][
'
gt
'
]
<=
sampleObject
.
zoomData
[
0
])
{
chartPiecesTemp
[
0
][
'
lt
'
]
=
sampleObject
.
zoomData
[
1
];
chartPiecesTemp
[
0
][
'
gt
'
]
=
sampleObject
.
zoomData
[
0
];
}
}
else
if
(
!
isNaN
(
chartPiecesTemp
[
0
][
'
lt
'
])
&&
!
isNaN
(
chartPiecesTemp
[
0
][
'
gt
'
])
)
{
if
(
chartPiecesTemp
[
0
][
'
gt
'
]
>=
sampleObject
.
zoomData
[
1
])
{
chartPiecesTemp
=
[];
}
else
{
if
(
chartPiecesTemp
[
0
][
'
gt
'
]
<=
sampleObject
.
zoomData
[
0
])
{
chartPiecesTemp
[
0
][
'
gt
'
]
=
sampleObject
.
zoomData
[
0
];
}
if
(
chartPiecesTemp
[
0
][
'
lt
'
]
>=
sampleObject
.
zoomData
[
1
])
{
chartPiecesTemp
[
0
][
'
lt
'
]
=
sampleObject
.
zoomData
[
1
];
}
if
(
chartPiecesTemp
[
0
][
'
lt
'
]
<=
sampleObject
.
zoomData
[
0
])
{
chartPiecesTemp
=
[];
}
}
}
}
if
(
chartPiecesTemp
.
length
===
2
)
{
const
relationalArr
=
[];
relationalArr
[
0
]
=
chartPiecesTemp
[
0
].
lt
||
chartPiecesTemp
[
1
].
lt
;
relationalArr
[
1
]
=
chartPiecesTemp
[
0
].
gt
||
chartPiecesTemp
[
1
].
gt
;
if
(
relationalArr
[
0
]
>=
sampleObject
.
zoomData
[
1
]
||
relationalArr
[
1
]
<=
sampleObject
.
zoomData
[
0
]
)
{
chartPiecesTemp
=
[
{
gt
:
sampleObject
.
zoomData
[
0
],
lt
:
sampleObject
.
zoomData
[
1
],
color
:
this
.
thresholdColor
,
},
];
}
else
{
if
(
relationalArr
[
0
]
<=
sampleObject
.
zoomData
[
0
])
{
if
(
!
isNaN
(
chartPiecesTemp
[
0
].
lt
))
{
chartPiecesTemp
[
0
].
lt
=
sampleObject
.
zoomData
[
0
];
}
else
{
chartPiecesTemp
[
1
].
lt
=
sampleObject
.
zoomData
[
0
];
}
}
if
(
relationalArr
[
1
]
>=
sampleObject
.
zoomData
[
1
])
{
if
(
!
isNaN
(
chartPiecesTemp
[
0
].
gt
))
{
chartPiecesTemp
[
0
].
gt
=
sampleObject
.
zoomData
[
1
];
}
else
{
chartPiecesTemp
[
1
].
gt
=
sampleObject
.
zoomData
[
1
];
}
}
}
}
if
(
chartPiecesTemp
.
length
>
0
)
{
tempCharOption
.
series
[
0
].
lineStyle
[
'
color
'
]
=
null
;
tempCharOption
.
visualMap
=
{};
tempCharOption
.
visualMap
[
'
show
'
]
=
false
;
tempCharOption
.
visualMap
[
'
pieces
'
]
=
chartPiecesTemp
;
tempCharOption
.
visualMap
[
'
outOfRange
'
]
=
{
color
:
sampleObject
.
colors
,
};
tempCharOption
.
series
[
0
][
'
markLine
'
]
=
{
precision
:
5
,
silent
:
true
,
data
:
markLineData
,
};
sampleObject
.
charObj
.
setOption
(
tempCharOption
,
false
);
}
},
/**
* formate PieceStr
* @param {Array} piecesArr piecesArr
* @return {String}
*/
formatePieceStr
(
piecesArr
)
{
if
(
piecesArr
.
length
===
0
)
{
return
;
}
piecesArr
.
forEach
((
item
)
=>
{
if
(
item
.
lt
)
{
item
.
lt
=
Number
(
item
.
lt
.
toFixed
(
5
));
}
if
(
item
.
gt
)
{
item
.
gt
=
Number
(
item
.
gt
.
toFixed
(
5
));
}
});
let
pieceStr
;
if
(
piecesArr
.
length
===
1
)
{
if
(
!
isNaN
(
piecesArr
[
0
].
gt
)
&&
!
isNaN
(
piecesArr
[
0
].
lt
))
{
pieceStr
=
`(
${
piecesArr
[
0
].
gt
}
,
${
piecesArr
[
0
].
lt
}
)`
;
}
else
if
(
!
isNaN
(
piecesArr
[
0
].
gt
)
&&
isNaN
(
piecesArr
[
0
].
lt
))
{
pieceStr
=
`(
${
piecesArr
[
0
].
gt
}
,Infinity)`
;
}
else
if
(
!
isNaN
(
piecesArr
[
0
].
lt
)
&&
isNaN
(
piecesArr
[
0
].
gt
))
{
pieceStr
=
`(-Infinity,
${
piecesArr
[
0
].
lt
}
)`
;
}
}
if
(
piecesArr
.
length
===
2
)
{
if
(
!
isNaN
(
piecesArr
[
0
].
lt
)
&&
!
isNaN
(
piecesArr
[
1
].
gt
))
{
pieceStr
=
`(-Infinity,
${
piecesArr
[
0
].
lt
}
),(
${
piecesArr
[
1
].
gt
}
,Infinity)`
;
}
else
if
(
!
isNaN
(
piecesArr
[
0
].
gt
)
&&
!
isNaN
(
piecesArr
[
1
].
lt
))
{
pieceStr
=
`(-Infinity,
${
piecesArr
[
1
].
lt
}
),(
${
piecesArr
[
0
].
gt
}
,Infinity)`
;
}
}
return
pieceStr
;
},
/**
/**
* threshold commit
* threshold commit
*/
*/
...
@@ -1981,32 +2142,8 @@ export default {
...
@@ -1981,32 +2142,8 @@ export default {
});
});
}
}
chartPieces
.
forEach
((
item
)
=>
{
if
(
item
.
lt
)
{
item
.
lt
=
Number
(
item
.
lt
.
toFixed
(
5
));
}
if
(
item
.
gt
)
{
item
.
gt
=
Number
(
item
.
gt
.
toFixed
(
5
));
}
});
let
pieceStr
=
''
;
let
pieceStr
=
''
;
if
(
chartPieces
.
length
===
1
)
{
pieceStr
=
this
.
formatePieceStr
(
chartPieces
);
if
(
!
isNaN
(
chartPieces
[
0
].
gt
)
&&
!
isNaN
(
chartPieces
[
0
].
lt
))
{
pieceStr
=
`(
${
chartPieces
[
0
].
gt
}
,
${
chartPieces
[
0
].
lt
}
)`
;
}
else
if
(
!
isNaN
(
chartPieces
[
0
].
gt
)
&&
isNaN
(
chartPieces
[
0
].
lt
))
{
pieceStr
=
`(
${
chartPieces
[
0
].
gt
}
,Infinity)`
;
}
else
if
(
!
isNaN
(
chartPieces
[
0
].
lt
)
&&
isNaN
(
chartPieces
[
0
].
gt
))
{
pieceStr
=
`(-Infinity,
${
chartPieces
[
0
].
lt
}
)`
;
}
}
if
(
chartPieces
.
length
===
2
)
{
if
(
!
isNaN
(
chartPieces
[
0
].
lt
)
&&
!
isNaN
(
chartPieces
[
1
].
gt
))
{
pieceStr
=
`(-Infinity,
${
chartPieces
[
0
].
lt
}
),(
${
chartPieces
[
1
].
gt
}
,Infinity)`
;
}
else
if
(
!
isNaN
(
chartPieces
[
0
].
gt
)
&&
!
isNaN
(
chartPieces
[
1
].
lt
))
{
pieceStr
=
`(-Infinity,
${
chartPieces
[
1
].
lt
}
),(
${
chartPieces
[
0
].
gt
}
,Infinity)`
;
}
}
if
(
!
this
.
thresholdLocal
)
{
if
(
!
this
.
thresholdLocal
)
{
this
.
thresholdLocal
=
{};
this
.
thresholdLocal
=
{};
...
@@ -2032,21 +2169,6 @@ export default {
...
@@ -2032,21 +2169,6 @@ export default {
const
chartPiecesTemp
=
JSON
.
parse
(
JSON
.
stringify
(
chartPieces
));
const
chartPiecesTemp
=
JSON
.
parse
(
JSON
.
stringify
(
chartPieces
));
if
(
chartPiecesTemp
.
length
===
1
)
{
let
itemValue
;
if
(
chartPiecesTemp
[
0
][
'
lt
'
]
||
chartPiecesTemp
[
0
][
'
lt
'
]
===
0
)
{
itemValue
=
chartPiecesTemp
[
0
][
'
lt
'
];
}
else
{
itemValue
=
chartPiecesTemp
[
0
][
'
gt
'
];
}
chartPiecesTemp
.
push
({
value
:
chartPiecesTemp
[
0
][
'
lt
'
]
||
chartPiecesTemp
[
0
][
'
lt
'
]
===
0
?
itemValue
+
1
:
itemValue
-
1
,
});
}
chartPiecesTemp
.
forEach
((
item
)
=>
{
chartPiecesTemp
.
forEach
((
item
)
=>
{
item
.
color
=
this
.
thresholdColor
;
item
.
color
=
this
.
thresholdColor
;
});
});
...
@@ -2060,18 +2182,7 @@ export default {
...
@@ -2060,18 +2182,7 @@ export default {
sampleObject
.
pieceStr
=
pieceStr
;
sampleObject
.
pieceStr
=
pieceStr
;
if
(
sampleObject
.
charObj
)
{
if
(
sampleObject
.
charObj
)
{
const
tempCharOption
=
sampleObject
.
charData
.
charOption
;
this
.
setVisualMap
(
sampleObject
,
chartPieces
);
tempCharOption
.
visualMap
.
pieces
=
chartPiecesTemp
;
tempCharOption
.
visualMap
.
outOfRange
=
{
color
:
sampleObject
.
colors
,
};
tempCharOption
.
series
[
0
].
lineStyle
.
color
=
null
;
tempCharOption
.
series
[
0
].
markLine
=
{
precision
:
5
,
silent
:
true
,
data
:
markLineData
,
};
sampleObject
.
charObj
.
setOption
(
tempCharOption
,
true
);
}
}
}
}
});
});
...
@@ -2080,18 +2191,7 @@ export default {
...
@@ -2080,18 +2191,7 @@ export default {
this
.
currentTagName
this
.
currentTagName
]
=
chartPieces
;
]
=
chartPieces
;
this
.
currentSample
.
pieceStr
=
pieceStr
;
this
.
currentSample
.
pieceStr
=
pieceStr
;
const
tempCharOption
=
this
.
currentSample
.
charData
.
charOption
;
this
.
setVisualMap
(
this
.
currentSample
,
chartPieces
);
tempCharOption
.
visualMap
.
pieces
=
chartPiecesTemp
;
tempCharOption
.
visualMap
.
outOfRange
=
{
color
:
this
.
currentSample
.
colors
,
};
tempCharOption
.
series
[
0
].
lineStyle
.
color
=
null
;
tempCharOption
.
series
[
0
].
markLine
=
{
precision
:
5
,
silent
:
true
,
data
:
markLineData
,
};
this
.
currentSample
.
charObj
.
setOption
(
tempCharOption
,
true
);
}
}
localStorage
.
setItem
(
localStorage
.
setItem
(
'
thresholdCache
'
,
'
thresholdCache
'
,
...
@@ -2128,6 +2228,9 @@ export default {
...
@@ -2128,6 +2228,9 @@ export default {
this
.
thresholdRelational
=
''
;
this
.
thresholdRelational
=
''
;
this
.
thresholdValue
[
1
].
filterCondition
=
this
.
$t
(
'
scalar.lessThan
'
);
this
.
thresholdValue
[
1
].
filterCondition
=
this
.
$t
(
'
scalar.lessThan
'
);
this
.
thresholdDialogVisible
=
false
;
this
.
thresholdDialogVisible
=
false
;
if
(
this
.
isTimeReload
)
{
this
.
autoUpdateSamples
();
}
},
},
},
},
components
:
{
components
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录