diff --git a/src/plugins/plot/MctPlot.vue b/src/plugins/plot/MctPlot.vue index 76815cc53d5..eac418b1fef 100644 --- a/src/plugins/plot/MctPlot.vue +++ b/src/plugins/plot/MctPlot.vue @@ -1113,6 +1113,7 @@ export default { } this.listenTo(window, 'mouseup', this.onMouseUp, this); + // TODO: Why do we need this mousemove listener when we have a mousemove listener on the canvas above? this.listenTo(window, 'mousemove', this.trackMousePosition, this); // track frozen state on mouseDown to be read on mouseUp @@ -1133,6 +1134,7 @@ export default { onMouseUp(event) { this.stopListening(window, 'mouseup', this.onMouseUp, this); + // TODO: Why do we need this when we have a mousemove listener on the canvas above? this.stopListening(window, 'mousemove', this.trackMousePosition, this); if (this.isMouseClick() && event.shiftKey) { diff --git a/src/plugins/plot/configuration/PlotSeries.js b/src/plugins/plot/configuration/PlotSeries.js index 9f4f8329ead..fd40cfa89d4 100644 --- a/src/plugins/plot/configuration/PlotSeries.js +++ b/src/plugins/plot/configuration/PlotSeries.js @@ -230,7 +230,9 @@ export default class PlotSeries extends Model { const newPoints = _(data) .concat(points) .sortBy(this.getXVal) - .uniq(true, (point) => [this.getXVal(point), this.getYVal(point)].join()) + .sortedUniqBy((point) => { + return [this.getXVal(point), this.getYVal(point)].join(); + }) .value(); this.reset(newPoints); } catch (error) { @@ -429,7 +431,7 @@ export default class PlotSeries extends Model { let data = this.getSeriesData(); let insertIndex = data.length; const currentYVal = this.getYVal(newData); - const lastYVal = this.getYVal(data[insertIndex - 1]); + const lastYVal = insertIndex > 0 ? this.getYVal(data[insertIndex - 1]) : undefined; if (this.isValueInvalid(currentYVal) && this.isValueInvalid(lastYVal)) { console.warn(`[Plot] Invalid Y Values detected: ${currentYVal} ${lastYVal}`); @@ -505,8 +507,12 @@ export default class PlotSeries extends Model { const pointsToRemove = startIndex + (data.length - endIndex + 1); if (pointsToRemove > 0) { if (pointsToRemove < 1000) { + // Remove all points up to the start index data.slice(0, startIndex).forEach(this.remove, this); - data.slice(endIndex, data.length).forEach(this.remove, this); + // Re-calculate the endIndex since the data array has changed, + // then remove items from endIndex to the end of the array + const newEndIndex = endIndex - startIndex + 1; + data.slice(newEndIndex, data.length).forEach(this.remove, this); this.updateSeriesData(data); this.resetStats(); } else { diff --git a/src/plugins/telemetryTable/TelemetryTableConfiguration.js b/src/plugins/telemetryTable/TelemetryTableConfiguration.js index 1a94c96d239..d2789827ed5 100644 --- a/src/plugins/telemetryTable/TelemetryTableConfiguration.js +++ b/src/plugins/telemetryTable/TelemetryTableConfiguration.js @@ -142,7 +142,7 @@ export default class TelemetryTableConfiguration extends EventEmitter { getAllHeaders() { let flattenedColumns = _.flatten(Object.values(this.columns)); /* eslint-disable you-dont-need-lodash-underscore/uniq */ - let headers = _.uniq(flattenedColumns, false, (column) => column.getKey()).reduce( + let headers = _.uniqBy(flattenedColumns, (column) => column.getKey()).reduce( fromColumnsToHeadersMap, {} );