Added listener that reacts to changes on interpolate + fetch data using correct strategy value. (#2469)

This commit is contained in:
Nikhil 2019-10-21 10:27:52 -07:00 committed by Deep Tailor
parent 68f3436792
commit d6950a0976
2 changed files with 13 additions and 2 deletions

View File

@ -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

View File

@ -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);
};