mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +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.
|
||||
*/
|
||||
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) {
|
||||
insertIndex = this.sortedIndex(point);
|
||||
if (this.getXVal(this.data[insertIndex]) === this.getXVal(point)) {
|
||||
@ -334,11 +342,21 @@ define([
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateStats(point);
|
||||
point.mctLimitState = this.evaluate(point);
|
||||
this.data.splice(insertIndex, 0, point);
|
||||
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.
|
||||
* @private
|
||||
|
@ -182,21 +182,6 @@ define([
|
||||
this.set('format', yFormat.format.bind(yFormat));
|
||||
this.set('values', yMetadata.values);
|
||||
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) {
|
||||
return s.metadata.value(s.get('yKey')).name;
|
||||
}).reduce(function (a, b) {
|
||||
@ -208,7 +193,28 @@ define([
|
||||
}
|
||||
return '';
|
||||
}, 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user