buckets.forEach((t, i) => { const change = changes[urn][i]; row[`${t}`] = { change: humanizeChange(change), direction: toColorDirection(change, isInverse(urn, entities)) }; row[`${t}_raw`] = makeSortable(change); });
[...this.offsets].forEach(offset => { const value = this._getAggregate(offset); const change = curr / value - 1; anomalyInfo[offset] = { value: humanizeFloat(value), // numerical value to display change: humanizeChange(change), // text of % change with + or - sign direction: toColorDirection(change, isInverse(metricUrn, entities)) }; });
metricUrns.forEach(urn => { // find first smaller or equal element const currentLookup = (lookup[toCurrentUrn(urn)] || []).reverse(); const currentTimeseries = currentLookup.find(t => t[0] <= hoverTimestamp); const current = currentTimeseries && currentTimeseries[1] ? currentTimeseries[1] : Number.NaN; const baselineLookup = (lookup[toBaselineUrn(urn)] || []).reverse(); const baselineTimeseries = baselineLookup.find(t => t[0] <= hoverTimestamp); const baseline = baselineTimeseries && baselineTimeseries[1] ? baselineTimeseries[1] : Number.NaN; const change = current / baseline - 1; values[urn] = { current: humanizeFloat(current), baseline: humanizeFloat(baseline), delta: humanizeChange(change), color: toColorDirection(change, isInverse(urn, entities)) }; });
function () { const { selectedUrn, entities } = this.getProperties('selectedUrn', 'entities'); return isInverse(selectedUrn, entities); }