diff --git a/src/app/components/timeSeries.js b/src/app/components/timeSeries.js index 2d1f918c5bf..ce8b0b8da40 100644 --- a/src/app/components/timeSeries.js +++ b/src/app/components/timeSeries.js @@ -10,6 +10,7 @@ function (_, kbn) { this.info = opts.info; this.label = opts.info.alias; this.valueFormater = kbn.valueFormats.none; + this.stats = {}; } function matchSeriesOverride(aliasOrRegex, seriesAlias) { @@ -61,9 +62,9 @@ function (_, kbn) { this.color = this.info.color; this.yaxis = this.info.yaxis; - this.info.total = 0; - this.info.max = -212312321312; - this.info.min = 212312321312; + this.stats.total = 0; + this.stats.max = -212312321312; + this.stats.min = 212312321312; var ignoreNulls = fillStyle === 'connected'; var nullAsZero = fillStyle === 'null as zero'; @@ -82,27 +83,27 @@ function (_, kbn) { } if (_.isNumber(currentValue)) { - this.info.total += currentValue; + this.stats.total += currentValue; } - if (currentValue > this.info.max) { - this.info.max = currentValue; + if (currentValue > this.stats.max) { + this.stats.max = currentValue; } - if (currentValue < this.info.min) { - this.info.min = currentValue; + if (currentValue < this.stats.min) { + this.stats.min = currentValue; } result.push([currentTime * 1000, currentValue]); } if (result.length > 2) { - this.info.timeStep = result[1][0] - result[0][0]; + this.stats.timeStep = result[1][0] - result[0][0]; } if (result.length) { - this.info.avg = (this.info.total / result.length); - this.info.current = result[result.length-1][1]; + this.stats.avg = (this.stats.total / result.length); + this.stats.current = result[result.length-1][1]; } return result; @@ -113,11 +114,11 @@ function (_, kbn) { this.decimals = decimals; this.scaledDecimals = scaledDecimals; - this.info.avg = this.formatValue(this.info.avg); - this.info.current = this.formatValue(this.info.current); - this.info.min = this.formatValue(this.info.min); - this.info.max = this.formatValue(this.info.max); - this.info.total = this.formatValue(this.info.total); + this.info.avg = this.formatValue(this.stats.avg); + this.info.current = this.formatValue(this.stats.current); + this.info.min = this.formatValue(this.stats.min); + this.info.max = this.formatValue(this.stats.max); + this.info.total = this.formatValue(this.stats.total); }; TimeSeries.prototype.formatValue = function(value) { diff --git a/src/app/directives/grafanaGraph.js b/src/app/directives/grafanaGraph.js index 97d5bb6aebd..f63eff7e1d3 100755 --- a/src/app/directives/grafanaGraph.js +++ b/src/app/directives/grafanaGraph.js @@ -111,6 +111,7 @@ function (angular, $, kbn, moment, _, GraphTooltip) { var axis = yaxis[series.yaxis - 1]; var formater = kbn.valueFormats[scope.panel.y_formats[series.yaxis - 1]]; series.updateLegendValues(formater, axis.tickDecimals, axis.scaledDecimals); + if(!scope.$$phase) { scope.$digest(); } } }