From 2b932492c26bd072d8e9361e57a0384ff29fe68e Mon Sep 17 00:00:00 2001 From: oliverpool Date: Thu, 12 Jan 2017 16:19:18 +0100 Subject: [PATCH] Add a `diff` aggregate `diff = current - first` (when available) --- public/app/core/time_series2.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/app/core/time_series2.ts b/public/app/core/time_series2.ts index 4503be68710..4563a09cbca 100644 --- a/public/app/core/time_series2.ts +++ b/public/app/core/time_series2.ts @@ -104,6 +104,7 @@ export default class TimeSeries { this.stats.current = null; this.stats.first = null; this.stats.delta = 0; + this.stats.diff = null; this.stats.range = null; this.stats.timeStep = Number.MAX_VALUE; this.allIsNull = true; @@ -193,6 +194,9 @@ export default class TimeSeries { if (this.stats.max !== null && this.stats.min !== null) { this.stats.range = this.stats.max - this.stats.min; } + if (this.stats.current !== null && this.stats.first !== null) { + this.stats.diff = this.stats.current - this.stats.first; + } this.stats.count = result.length; return result;