[Plot] pass persisted config in constructor

When a plot series is constructed, it checks to see if should set a
default interpolation based on the persisted configuration.  However,
the persisted configuration wasn't available until after construction
which resulted in the default value always being set.

Pass the persisted configuration through the constructor to ensure the
plot series can make the right decision about defaults.

Fixes #2120.
This commit is contained in:
Pete Richards 2018-07-31 12:28:20 -07:00
parent 04cc8f7aa2
commit 3c075b7ff2
2 changed files with 6 additions and 4 deletions

View File

@ -83,6 +83,7 @@ define([
this.listenTo(this, 'change:xKey', this.onXKeyChange, this);
this.listenTo(this, 'change:yKey', this.onYKeyChange, this);
this.persistedConfig = options.persistedConfig;
Model.apply(this, arguments);
this.onXKeyChange(this.get('xKey'));
@ -176,8 +177,7 @@ define([
return;
}
var valueMetadata = this.metadata.value(newKey);
var persistedConfig = this.get('persistedConfiguration');
if (!persistedConfig || !persistedConfig.interpolate) {
if (!this.persistedConfig || !this.persistedConfig.interpolate) {
if (valueMetadata.format === 'enum') {
this.set('interpolate', 'stepAfter');
} else {

View File

@ -54,7 +54,7 @@ define([
domainObject.configuration.series.forEach(function (seriesConfig) {
var series = this.byIdentifier(seriesConfig.identifier);
if (series) {
series.set('persistedConfiguration', seriesConfig);
series.persistedConfig = seriesConfig;
}
}, this);
},
@ -90,7 +90,9 @@ define([
model: seriesConfig,
domainObject: domainObject,
collection: this,
openmct: this.openmct
openmct: this.openmct,
persistedConfig: this.plot
.getPersistedSeriesConfig(domainObject.identifier)
}));
},
removeTelemetryObject: function (identifier) {