aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2017-11-03 18:57:48 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2017-11-03 18:57:48 +0300
commit4f14254d5bcf1038a26c6a7578d07500bbbfb96f (patch)
tree65ee096130c249d154f40af727259b6118c09de9 /interface
parentf6a4970acf6cd6172ddf5519c38e247628de75a9 (diff)
downloadrspamd-4f14254d5bcf1038a26c6a7578d07500bbbfb96f.tar.gz
rspamd-4f14254d5bcf1038a26c6a7578d07500bbbfb96f.zip
[WebUI] Fix message count in throughput summary (#1724)
MFH: rspamd-1.6
Diffstat (limited to 'interface')
-rw-r--r--interface/js/app/graph.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js
index 029bf054c..c082e6a3c 100644
--- a/interface/js/app/graph.js
+++ b/interface/js/app/graph.js
@@ -112,14 +112,17 @@ function($, D3Evolution, unused) {
var timeInterval = xExtents[1] - xExtents[0];
return json.map(function (curr, i) {
+ // Time intervals that don't have data are excluded from average calculation as d3.mean()ignores nulls
var avg = d3.mean(curr, function (d) { return d.y; });
+ // To find an integral on the whole time interval we need to convert nulls to zeroes
+ var value = d3.mean(curr, function (d) { return +d.y; }) * timeInterval / scaleFactor;
var yExtents = d3.extent(curr, function (d) { return d.y; });
return {
label: graph_options.legend.entries[i].label,
- value: avg && (avg * timeInterval / scaleFactor) ^ 0,
+ value: value ^ 0,
min: +yExtents[0].toFixed(6),
- avg: avg && +avg.toFixed(6),
+ avg: +avg.toFixed(6),
max: +yExtents[1].toFixed(6),
last: +curr[curr.length - 1].y.toFixed(6),
color: graph_options.legend.entries[i].color,