Commit 0cba8183 by Torkel Ödegaard

Graph: legend and digest phase fix

parent 4285c751
......@@ -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) {
......
......@@ -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(); }
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment