aboutsummaryrefslogtreecommitdiffstats
path: root/interface/js/rspamd.js
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2017-01-07 21:07:55 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2017-01-07 21:07:55 +0300
commit5fd14880eb5608bed7244aee10b57c7f1d93cd3e (patch)
treef6e654c19d4a8d26d86d6e90210ee66ddb4276c6 /interface/js/rspamd.js
parentfb8e7988112ed7e93a2b1e239e392fd8260965b3 (diff)
downloadrspamd-5fd14880eb5608bed7244aee10b57c7f1d93cd3e.tar.gz
rspamd-5fd14880eb5608bed7244aee10b57c7f1d93cd3e.zip
[WebUI] RRD summary: Respect undefined values
Diffstat (limited to 'interface/js/rspamd.js')
-rw-r--r--interface/js/rspamd.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/interface/js/rspamd.js b/interface/js/rspamd.js
index 41cac8f46..18e5f9e0c 100644
--- a/interface/js/rspamd.js
+++ b/interface/js/rspamd.js
@@ -632,14 +632,14 @@
const timeInterval = xExtents[1] - xExtents[0];
return json.map(function (curr, i) {
- var avg = d3.sum(curr, function (d) { return d.y; }) / curr.length;
+ var avg = d3.mean(curr, function (d) { return d.y; });
var yExtents = d3.extent(curr, function (d) { return d.y; });
return {
label: graph_options.legend.entries[i].label,
- value: (avg * timeInterval) ^ 0,
+ value: avg && (avg * timeInterval) ^ 0,
min: yExtents[0],
- avg: avg.toFixed(6),
+ avg: avg && avg.toFixed(6),
max: yExtents[1],
last: curr[curr.length - 1].y,
color: graph_options.legend.entries[i].color,
@@ -656,10 +656,10 @@
data: data,
columns: [
{ data: "label", title: "Action" },
- { data: "value", title: "Messages" },
- { data: "min", title: "Minimum, msg/s" },
- { data: "avg", title: "Average, msg/s" },
- { data: "max", title: "Maximum, msg/s" },
+ { data: "value", title: "Messages", defaultContent: "" },
+ { data: "min", title: "Minimum, msg/s", defaultContent: "" },
+ { data: "avg", title: "Average, msg/s", defaultContent: "" },
+ { data: "max", title: "Maximum, msg/s", defaultContent: "" },
{ data: "last", title: "Last, msg/s" },
],