v2.12.6
Utility functions
Add getCumulativeAverage
and getCumulativeMedian
utility functions:
getCumulativeAverage
import { getCumulativeAverage } from "vue-data-ui";
// Simple usage
const arr = [0, 1, 2, 3, 4];
const cumulativeAvg = getCumulativeAverage({ values: arr });
// Ignore invalid values entirely
const arrWithInvalid = [0, 1, 2, null, undefined, NaN, Infinity, -Infinity];
const cumulativeAvgNoInvalid = getCumulativeAverage({
values: arrWithInvalid,
config: { keepInvalid: false }
});
// Convert invalid values to zero
const cumulativeAvgZeroed = getCumulativeAverage({
values: arrWithInvalid,
config: { convertInvalidToZero: true }
});
getCumulativeMedian
import { getCumulativeMedian } from "vue-data-ui";
// Simple usage
const arr = [0, 1, 2, 3, 4];
const cumulativeMed = getCumulativeMedian({ values: arr });
// Ignore invalid values entirely
const arrWithInvalid = [0, 1, 2, null, undefined, NaN, Infinity, -Infinity];
const cumulativeMedNoInvalid = getCumulativeMedian({
values: arrWithInvalid,
config: { keepInvalid: false }
});
// Convert invalid values to zero
const cumulativeMedZeroed = getCumulativeMedian({
values: arrWithInvalid,
config: { convertInvalidToZero: true }
});