mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 22:17:49 +00:00
add sample size
This commit is contained in:
parent
395436a361
commit
3f92deb896
@ -60,7 +60,8 @@ export default class CompsManager extends EventEmitter {
|
||||
valueToUse,
|
||||
testValue: 0,
|
||||
timeMetaData,
|
||||
accumulateValues: false
|
||||
accumulateValues: false,
|
||||
sampleSize: null
|
||||
});
|
||||
this.emit('parameterAdded', this.#domainObject);
|
||||
}
|
||||
|
@ -83,6 +83,14 @@ function calculate(dataFrame, parameters, expression) {
|
||||
accumulatedData[referenceParameter.name].push(referenceValue);
|
||||
referenceValue = accumulatedData[referenceParameter.name];
|
||||
}
|
||||
if (referenceParameter.sampleSize) {
|
||||
// enforce sample size by ensuring referenceValue has the latest n elements
|
||||
// if we don't have at least the sample size, skip this iteration
|
||||
if (referenceValue.length < referenceParameter.sampleSize) {
|
||||
return;
|
||||
}
|
||||
referenceValue = referenceValue.slice(-referenceParameter.sampleSize);
|
||||
}
|
||||
|
||||
const scope = {
|
||||
[referenceParameter.name]: referenceValue
|
||||
|
@ -102,6 +102,7 @@
|
||||
]"
|
||||
>
|
||||
<label v-if="isEditing" class="c-toggle-switch">
|
||||
<span class="c-toggle-switch__label">Accumulate Values</span>
|
||||
<input
|
||||
v-model="parameter.accumulateValues"
|
||||
type="checkbox"
|
||||
@ -111,8 +112,19 @@
|
||||
class="c-toggle-switch__slider"
|
||||
aria-label="Toggle Parameter Accumulation"
|
||||
></span>
|
||||
<span class="c-toggle-switch__label">Accumulate Values</span>
|
||||
</label>
|
||||
|
||||
<span v-if="isEditing && parameter.accumulateValues" class="c-test-datum__string"
|
||||
>Sample Size</span
|
||||
>
|
||||
<input
|
||||
v-if="isEditing && parameter.accumulateValues"
|
||||
v-model="parameter.sampleSize"
|
||||
:aria-label="`Sample Size for ${parameter.name}`"
|
||||
type="text"
|
||||
class="c-input--md"
|
||||
@change="updateParameters"
|
||||
/>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user