mirror of
https://github.com/nasa/openmct.git
synced 2025-06-04 00:20:50 +00:00
* prevent plots from breaking when more than one NaN is received. * fix y axis label issue * dont emit a viewport change event when marquee doesnt happen
This commit is contained in:
parent
43628ad9d6
commit
04598b6cf1
@ -324,7 +324,15 @@ define([
|
|||||||
* a point to the end without dupe checking.
|
* a point to the end without dupe checking.
|
||||||
*/
|
*/
|
||||||
add: function (point, appendOnly) {
|
add: function (point, appendOnly) {
|
||||||
var insertIndex = this.data.length;
|
var insertIndex = this.data.length,
|
||||||
|
currentYVal = this.getYVal(point),
|
||||||
|
lastYVal = this.getYVal(this.data[insertIndex - 1]);
|
||||||
|
|
||||||
|
if (this.isValueInvalid(currentYVal) && this.isValueInvalid(lastYVal)) {
|
||||||
|
console.warn('[Plot] Invalid Y Values detected');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!appendOnly) {
|
if (!appendOnly) {
|
||||||
insertIndex = this.sortedIndex(point);
|
insertIndex = this.sortedIndex(point);
|
||||||
if (this.getXVal(this.data[insertIndex]) === this.getXVal(point)) {
|
if (this.getXVal(this.data[insertIndex]) === this.getXVal(point)) {
|
||||||
@ -334,11 +342,21 @@ define([
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateStats(point);
|
this.updateStats(point);
|
||||||
point.mctLimitState = this.evaluate(point);
|
point.mctLimitState = this.evaluate(point);
|
||||||
this.data.splice(insertIndex, 0, point);
|
this.data.splice(insertIndex, 0, point);
|
||||||
this.emit('add', point, insertIndex, this);
|
this.emit('add', point, insertIndex, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
isValueInvalid: function (val) {
|
||||||
|
return Number.isNaN(val) || val === undefined;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a point from the data array and notify listeners.
|
* Remove a point from the data array and notify listeners.
|
||||||
* @private
|
* @private
|
||||||
|
@ -182,21 +182,6 @@ define([
|
|||||||
this.set('format', yFormat.format.bind(yFormat));
|
this.set('format', yFormat.format.bind(yFormat));
|
||||||
this.set('values', yMetadata.values);
|
this.set('values', yMetadata.values);
|
||||||
if (!label) {
|
if (!label) {
|
||||||
var labelUnits = series.map(function (s) {
|
|
||||||
return s.metadata.value(s.get('yKey')).units;
|
|
||||||
}).reduce(function (a, b) {
|
|
||||||
if (a === undefined) {
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
if (a === b) {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}, undefined);
|
|
||||||
if (labelUnits) {
|
|
||||||
this.set('label', labelUnits);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var labelName = series.map(function (s) {
|
var labelName = series.map(function (s) {
|
||||||
return s.metadata.value(s.get('yKey')).name;
|
return s.metadata.value(s.get('yKey')).name;
|
||||||
}).reduce(function (a, b) {
|
}).reduce(function (a, b) {
|
||||||
@ -208,7 +193,28 @@ define([
|
|||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}, undefined);
|
}, undefined);
|
||||||
this.set('label', labelName);
|
|
||||||
|
if (labelName) {
|
||||||
|
this.set('label', labelName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var labelUnits = series.map(function (s) {
|
||||||
|
return s.metadata.value(s.get('yKey')).units;
|
||||||
|
}).reduce(function (a, b) {
|
||||||
|
if (a === undefined) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
if (a === b) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}, undefined);
|
||||||
|
|
||||||
|
if (labelUnits) {
|
||||||
|
this.set('label', labelUnits);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaults: function (options) {
|
defaults: function (options) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user