Browse Source

Optimized switching pair logic

tags/v1.1.0
wwx691809 5 years ago
parent
commit
31de467c64
3 changed files with 39 additions and 14 deletions
  1. +2
    -1
      mindinsight/ui/src/locales/en-us.json
  2. +2
    -1
      mindinsight/ui/src/locales/zh-cn.json
  3. +35
    -12
      mindinsight/ui/src/views/train-manage/scalar.vue

+ 2
- 1
mindinsight/ui/src/locales/en-us.json View File

@@ -185,7 +185,8 @@
"sameCompare": "The comparison operator must be unique.",
"unreasonable": "The logic is improper.",
"info": "Information",
"isDelete": "Are you sure you want to delete the current threshold?"
"isDelete": "Are you sure you want to delete the current threshold?",
"noLog":"There is no logarithm of 0 and negative numbers"
},
"images": {
"titleText": "Image",


+ 2
- 1
mindinsight/ui/src/locales/zh-cn.json View File

@@ -184,7 +184,8 @@
"sameCompare": "不能有相同的比较运算符",
"unreasonable": "逻辑不合理",
"info": "提示",
"isDelete": "是否删除当前阈值"
"isDelete": "是否删除当前阈值?",
"noLog":"不存在0和负数的对数"
},
"images": {
"titleText": "图像",


+ 35
- 12
mindinsight/ui/src/views/train-manage/scalar.vue View File

@@ -343,20 +343,22 @@ export default {
)}-${this.$t('scalar.titleText')}-MindInsight`;
// Adding a Listener
window.addEventListener('resize', this.resizeCallback, false);
// Dom ready
this.$nextTick(() => {
// Initializing Data
this.getScalarsList();

// Initializing Data
this.getScalarsList();
this.firstNum = 1;

this.firstNum = 1;
this.decodeTrainingJobId = decodeURIComponent(this.trainingJobId);

this.decodeTrainingJobId = decodeURIComponent(this.trainingJobId);
this.getCache();

this.getCache();

// Auto refresh
if (this.isTimeReload) {
this.autoUpdateSamples();
}
// Auto refresh
if (this.isTimeReload) {
this.autoUpdateSamples();
}
});
},
methods: {
/**
@@ -528,11 +530,16 @@ export default {
if (resData.metadatas.length) {
relativeTimeBench = resData.metadatas[0].wall_time;
}

const mathData = [];
// Initializing chart data
resData.metadatas.forEach((metaData) => {
if (metaData.value === null && !hasInvalidData) {
hasInvalidData = true;
}
if (!isNaN(metaData.value) && metaData.value !== null) {
mathData.push(metaData.value);
}
tempObject.valueData.stepData.push([
metaData.step,
metaData.value,
@@ -556,6 +563,16 @@ export default {
]);
});

// Numerical range
const maxData = Math.max(...mathData);
const minData = Math.min(...mathData);
sampleObject.max = maxData;
if (maxData === minData) {
sampleObject.isEqual = true;
} else {
sampleObject.isEqual = false;
}

sampleObject.charData.oriData[0] = tempObject;

if (hasInvalidData) {
@@ -715,7 +732,9 @@ export default {
yAxis: {
type: sampleObject.log ? 'log' : 'value',
scale: true,
logBase: 10,
// Logbase for very small values,default 10
logBase: sampleObject.max < 1 && sampleObject.isEqual ? 0.1 : 10,
inverse: sampleObject.max < 1 && sampleObject.isEqual ? true : false,
axisLine: {
lineStyle: {
color: '#E6EBF5',
@@ -921,7 +940,7 @@ export default {
},
myTool2: {
show: true,
title: this.$t('scalar.toggleYaxisScale'),
title: sampleObject.max<=0 ? this.$t('scalar.noLog') : this.$t('scalar.toggleYaxisScale'),
iconStyle: {
borderColor: sampleObject.log ? '#00A5A7' : '#6D7278',
},
@@ -1527,6 +1546,10 @@ export default {
if (!sampleObject) {
return;
}
// There is no logarithm of 0 and negative numbers
if (sampleObject.max<=0) {
return;
}
this.yAxisScaleTimer = setTimeout(() => {
const tempOption = sampleObject.charData.charOption;
const tempOriData = sampleObject.charData.oriData;


Loading…
Cancel
Save