mirror of
https://github.com/nasa/openmct.git
synced 2025-03-11 06:54:01 +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,
|
valueToUse,
|
||||||
testValue: 0,
|
testValue: 0,
|
||||||
timeMetaData,
|
timeMetaData,
|
||||||
accumulateValues: false
|
accumulateValues: false,
|
||||||
|
sampleSize: null
|
||||||
});
|
});
|
||||||
this.emit('parameterAdded', this.#domainObject);
|
this.emit('parameterAdded', this.#domainObject);
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,14 @@ function calculate(dataFrame, parameters, expression) {
|
|||||||
accumulatedData[referenceParameter.name].push(referenceValue);
|
accumulatedData[referenceParameter.name].push(referenceValue);
|
||||||
referenceValue = accumulatedData[referenceParameter.name];
|
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 = {
|
const scope = {
|
||||||
[referenceParameter.name]: referenceValue
|
[referenceParameter.name]: referenceValue
|
||||||
|
@ -102,6 +102,7 @@
|
|||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<label v-if="isEditing" class="c-toggle-switch">
|
<label v-if="isEditing" class="c-toggle-switch">
|
||||||
|
<span class="c-toggle-switch__label">Accumulate Values</span>
|
||||||
<input
|
<input
|
||||||
v-model="parameter.accumulateValues"
|
v-model="parameter.accumulateValues"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@ -111,8 +112,19 @@
|
|||||||
class="c-toggle-switch__slider"
|
class="c-toggle-switch__slider"
|
||||||
aria-label="Toggle Parameter Accumulation"
|
aria-label="Toggle Parameter Accumulation"
|
||||||
></span>
|
></span>
|
||||||
<span class="c-toggle-switch__label">Accumulate Values</span>
|
|
||||||
</label>
|
</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>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user