From d6950a09765e2956013c87f63b532a64687a752b Mon Sep 17 00:00:00 2001 From: Nikhil Date: Mon, 21 Oct 2019 10:27:52 -0700 Subject: [PATCH] Added listener that reacts to changes on interpolate + fetch data using correct strategy value. (#2469) --- src/plugins/plot/src/configuration/PlotSeries.js | 3 ++- src/plugins/plot/src/telemetry/PlotController.js | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/plot/src/configuration/PlotSeries.js b/src/plugins/plot/src/configuration/PlotSeries.js index 9430d2a18e..cd208873f1 100644 --- a/src/plugins/plot/src/configuration/PlotSeries.js +++ b/src/plugins/plot/src/configuration/PlotSeries.js @@ -140,7 +140,8 @@ define([ * @returns {Promise} */ fetch: function (options) { - options = _.extend({}, {size: 1000, strategy: 'minmax', filters: this.filters}, options || {}); + const strategy = options.shouldUseMinMax ? 'minMax' : undefined; + options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {}); if (!this.unsubscribe) { this.unsubscribe = this.openmct .telemetry diff --git a/src/plugins/plot/src/telemetry/PlotController.js b/src/plugins/plot/src/telemetry/PlotController.js index f01792d65b..3d63718958 100644 --- a/src/plugins/plot/src/telemetry/PlotController.js +++ b/src/plugins/plot/src/telemetry/PlotController.js @@ -102,7 +102,8 @@ define([ this.startLoading(); var options = { size: this.$element[0].offsetWidth, - domain: this.config.xAxis.get('key') + domain: this.config.xAxis.get('key'), + shouldUseMinMax: this.shouldUseMinMax(series) }; series.load(options) @@ -133,6 +134,11 @@ define([ this.listenTo(series, 'change:yKey', function () { this.loadSeriesData(series); }, this); + + this.listenTo(series, 'change:interpolate', function () { + this.loadSeriesData(series); + }, this); + this.loadSeriesData(series); }; @@ -155,6 +161,10 @@ define([ return config; }; + PlotController.prototype.shouldUseMinMax = function (series) { + return series.model.interpolate !== 'none'; + }; + PlotController.prototype.onTimeSystemChange = function (timeSystem) { this.config.xAxis.set('key', timeSystem.key); };