mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 22:17:49 +00:00
[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:
parent
04cc8f7aa2
commit
3c075b7ff2
@ -83,6 +83,7 @@ define([
|
|||||||
|
|
||||||
this.listenTo(this, 'change:xKey', this.onXKeyChange, this);
|
this.listenTo(this, 'change:xKey', this.onXKeyChange, this);
|
||||||
this.listenTo(this, 'change:yKey', this.onYKeyChange, this);
|
this.listenTo(this, 'change:yKey', this.onYKeyChange, this);
|
||||||
|
this.persistedConfig = options.persistedConfig;
|
||||||
|
|
||||||
Model.apply(this, arguments);
|
Model.apply(this, arguments);
|
||||||
this.onXKeyChange(this.get('xKey'));
|
this.onXKeyChange(this.get('xKey'));
|
||||||
@ -176,8 +177,7 @@ define([
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var valueMetadata = this.metadata.value(newKey);
|
var valueMetadata = this.metadata.value(newKey);
|
||||||
var persistedConfig = this.get('persistedConfiguration');
|
if (!this.persistedConfig || !this.persistedConfig.interpolate) {
|
||||||
if (!persistedConfig || !persistedConfig.interpolate) {
|
|
||||||
if (valueMetadata.format === 'enum') {
|
if (valueMetadata.format === 'enum') {
|
||||||
this.set('interpolate', 'stepAfter');
|
this.set('interpolate', 'stepAfter');
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,7 +54,7 @@ define([
|
|||||||
domainObject.configuration.series.forEach(function (seriesConfig) {
|
domainObject.configuration.series.forEach(function (seriesConfig) {
|
||||||
var series = this.byIdentifier(seriesConfig.identifier);
|
var series = this.byIdentifier(seriesConfig.identifier);
|
||||||
if (series) {
|
if (series) {
|
||||||
series.set('persistedConfiguration', seriesConfig);
|
series.persistedConfig = seriesConfig;
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
@ -90,7 +90,9 @@ define([
|
|||||||
model: seriesConfig,
|
model: seriesConfig,
|
||||||
domainObject: domainObject,
|
domainObject: domainObject,
|
||||||
collection: this,
|
collection: this,
|
||||||
openmct: this.openmct
|
openmct: this.openmct,
|
||||||
|
persistedConfig: this.plot
|
||||||
|
.getPersistedSeriesConfig(domainObject.identifier)
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
removeTelemetryObject: function (identifier) {
|
removeTelemetryObject: function (identifier) {
|
||||||
|
Loading…
Reference in New Issue
Block a user