Browse Source

Values less than 0 have no logarithm. Set empty string and echart does not render

tags/v1.1.0
wwx691809 5 years ago
parent
commit
fc067fa088
2 changed files with 29 additions and 25 deletions
  1. +26
    -23
      mindinsight/ui/src/mixins/threshold.vue
  2. +3
    -2
      mindinsight/ui/src/views/train-manage/scalar.vue

+ 26
- 23
mindinsight/ui/src/mixins/threshold.vue View File

@@ -25,8 +25,8 @@ export default {
thresholdErrorMsg: '', thresholdErrorMsg: '',
thresholdRelational: '', thresholdRelational: '',
thresholdValue: [ thresholdValue: [
{filterCondition: this.$t('scalar.lessThan'), value: ''},
{filterCondition: this.$t('scalar.lessThan'), value: ''},
{ filterCondition: this.$t('scalar.lessThan'), value: '' },
{ filterCondition: this.$t('scalar.lessThan'), value: '' },
], ],
filterOptions: [ filterOptions: [
{ {
@@ -53,7 +53,7 @@ export default {
if (localStorage.getItem('thresholdCache')) { if (localStorage.getItem('thresholdCache')) {
try { try {
this.thresholdLocal = JSON.parse( this.thresholdLocal = JSON.parse(
localStorage.getItem('thresholdCache'),
localStorage.getItem('thresholdCache')
); );
this.clearCache(); this.clearCache();
} catch (e) { } catch (e) {
@@ -80,8 +80,8 @@ export default {
) { ) {
delete this.thresholdLocal[this.decodeTrainingJobId]; delete this.thresholdLocal[this.decodeTrainingJobId];
localStorage.setItem( localStorage.setItem(
'thresholdCache',
JSON.stringify(this.thresholdLocal),
'thresholdCache',
JSON.stringify(this.thresholdLocal)
); );
} }
} }
@@ -94,7 +94,7 @@ export default {


setOnePoint(sampleObject) { setOnePoint(sampleObject) {
const that = this; const that = this;
sampleObject.charObj.on('datazoom', function(params) {
sampleObject.charObj.on('datazoom', function (params) {
const xAxisObject = params.batch[0]; const xAxisObject = params.batch[0];
const yAxisObject = params.batch[1]; const yAxisObject = params.batch[1];
const charData = sampleObject.charData.charOption.series[0].data; const charData = sampleObject.charData.charOption.series[0].data;
@@ -153,7 +153,7 @@ export default {


setRestore(sampleObject) { setRestore(sampleObject) {
const that = this; const that = this;
sampleObject.charObj.on('restore', function(params) {
sampleObject.charObj.on('restore', function (params) {
const charData = sampleObject.charData.charOption.series[0].data; const charData = sampleObject.charData.charOption.series[0].data;
const tempCharOption = sampleObject.charData.charOption; const tempCharOption = sampleObject.charData.charOption;


@@ -193,9 +193,9 @@ export default {
this.thresholdLocal[this.decodeTrainingJobId][sampleObject.tagName] this.thresholdLocal[this.decodeTrainingJobId][sampleObject.tagName]
) { ) {
const tempStorgeArr = JSON.parse( const tempStorgeArr = JSON.parse(
JSON.stringify(
this.thresholdLocal[this.decodeTrainingJobId][sampleObject.tagName],
),
JSON.stringify(
this.thresholdLocal[this.decodeTrainingJobId][sampleObject.tagName]
)
); );
let pieceStr = ''; let pieceStr = '';
pieceStr = this.formatePieceStr(tempStorgeArr); pieceStr = this.formatePieceStr(tempStorgeArr);
@@ -228,7 +228,7 @@ export default {
this.thresholdLocal[this.decodeTrainingJobId][sampleItem.tagName] this.thresholdLocal[this.decodeTrainingJobId][sampleItem.tagName]
) { ) {
delete this.thresholdLocal[this.decodeTrainingJobId][ delete this.thresholdLocal[this.decodeTrainingJobId][
sampleItem.tagName
sampleItem.tagName
]; ];
} }
this.currentTagName = sampleItem.tagName; this.currentTagName = sampleItem.tagName;
@@ -415,8 +415,8 @@ export default {
// Two filter condition // Two filter condition
if (chartPiecesTemp.length === 2) { if (chartPiecesTemp.length === 2) {
const relationalArr = []; const relationalArr = [];
relationalArr[0] = chartPiecesTemp[0].lt || chartPiecesTemp[1].lt;
relationalArr[1] = chartPiecesTemp[0].gt || chartPiecesTemp[1].gt;
relationalArr[0] = chartPiecesTemp[0].lt || chartPiecesTemp[1].lt || 0;
relationalArr[1] = chartPiecesTemp[0].gt || chartPiecesTemp[1].gt || 0;
if ( if (
relationalArr[0] >= sampleObject.zoomData[1] || relationalArr[0] >= sampleObject.zoomData[1] ||
relationalArr[1] <= sampleObject.zoomData[0] relationalArr[1] <= sampleObject.zoomData[0]
@@ -459,6 +459,9 @@ export default {
data: markLineData, data: markLineData,
}; };


sampleObject.charObj.setOption(tempCharOption, false);
} else {
tempCharOption.series[0].lineStyle['color'] = sampleObject.colors;
sampleObject.charObj.setOption(tempCharOption, false); sampleObject.charObj.setOption(tempCharOption, false);
} }
}, },
@@ -577,7 +580,7 @@ export default {
this.originDataArr.forEach((sampleObject) => { this.originDataArr.forEach((sampleObject) => {
if (this.multiSelectedTagNames[sampleObject.tagName]) { if (this.multiSelectedTagNames[sampleObject.tagName]) {
this.thresholdLocal[this.decodeTrainingJobId][ this.thresholdLocal[this.decodeTrainingJobId][
sampleObject.tagName
sampleObject.tagName
] = chartPieces; ] = chartPieces;
sampleObject.pieceStr = pieceStr; sampleObject.pieceStr = pieceStr;


@@ -588,14 +591,14 @@ export default {
}); });
} else { } else {
this.thresholdLocal[this.decodeTrainingJobId][ this.thresholdLocal[this.decodeTrainingJobId][
this.currentTagName
this.currentTagName
] = chartPieces; ] = chartPieces;
this.currentSample.pieceStr = pieceStr; this.currentSample.pieceStr = pieceStr;
this.setVisualMap(this.currentSample, chartPieces); this.setVisualMap(this.currentSample, chartPieces);
} }
localStorage.setItem( localStorage.setItem(
'thresholdCache',
JSON.stringify(this.thresholdLocal),
'thresholdCache',
JSON.stringify(this.thresholdLocal)
); );


this.thresholdDialogVisible = false; this.thresholdDialogVisible = false;
@@ -660,11 +663,11 @@ export default {
this.thresholdLocal && this.thresholdLocal &&
this.thresholdLocal[this.decodeTrainingJobId] && this.thresholdLocal[this.decodeTrainingJobId] &&
this.thresholdLocal[this.decodeTrainingJobId][ this.thresholdLocal[this.decodeTrainingJobId][
sampleObject.tagName
sampleObject.tagName
] ]
) { ) {
delete this.thresholdLocal[this.decodeTrainingJobId][ delete this.thresholdLocal[this.decodeTrainingJobId][
sampleObject.tagName
sampleObject.tagName
]; ];
sampleObject.pieceStr = ''; sampleObject.pieceStr = '';
const tempCharOption = sampleObject.charData.charOption; const tempCharOption = sampleObject.charData.charOption;
@@ -691,7 +694,7 @@ export default {
this.thresholdLocal[this.decodeTrainingJobId][this.currentTagName] this.thresholdLocal[this.decodeTrainingJobId][this.currentTagName]
) { ) {
delete this.thresholdLocal[this.decodeTrainingJobId][ delete this.thresholdLocal[this.decodeTrainingJobId][
this.currentTagName
this.currentTagName
]; ];
this.currentSample.pieceStr = ''; this.currentSample.pieceStr = '';
const tempCharOption = this.currentSample.charData.charOption; const tempCharOption = this.currentSample.charData.charOption;
@@ -703,7 +706,7 @@ export default {
tempCharOption.visualMap = null; tempCharOption.visualMap = null;
tempCharOption.series[0].markLine = null; tempCharOption.series[0].markLine = null;
tempCharOption.series[0].lineStyle[ tempCharOption.series[0].lineStyle[
'color'
'color'
] = this.currentSample.colors; ] = this.currentSample.colors;
} }
this.currentSample.charObj.setOption(tempCharOption, false); this.currentSample.charObj.setOption(tempCharOption, false);
@@ -711,8 +714,8 @@ export default {
} }
this.clearCache(); this.clearCache();
localStorage.setItem( localStorage.setItem(
'thresholdCache',
JSON.stringify(this.thresholdLocal),
'thresholdCache',
JSON.stringify(this.thresholdLocal)
); );
this.delThresholdVisible = false; this.delThresholdVisible = false;
}, },


+ 3
- 2
mindinsight/ui/src/views/train-manage/scalar.vue View File

@@ -528,7 +528,6 @@ export default {
if (resData.metadatas.length) { if (resData.metadatas.length) {
relativeTimeBench = resData.metadatas[0].wall_time; relativeTimeBench = resData.metadatas[0].wall_time;
} }

// Initializing chart data // Initializing chart data
resData.metadatas.forEach((metaData) => { resData.metadatas.forEach((metaData) => {
if (metaData.value === null && !hasInvalidData) { if (metaData.value === null && !hasInvalidData) {
@@ -546,7 +545,9 @@ export default {
metaData.wall_time - relativeTimeBench, metaData.wall_time - relativeTimeBench,
metaData.value, metaData.value,
]); ]);
const logValue = metaData.value >= 0 ? metaData.value : '';
// Values less than 0 have no logarithm
// Set empty string and echart does not render
const logValue = metaData.value > 0 ? metaData.value : '';
tempObject.logData.stepData.push([metaData.step, logValue]); tempObject.logData.stepData.push([metaData.step, logValue]);
tempObject.logData.absData.push([metaData.wall_time, logValue]); tempObject.logData.absData.push([metaData.wall_time, logValue]);
tempObject.logData.relativeData.push([ tempObject.logData.relativeData.push([


Loading…
Cancel
Save