summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 647abae)
raw | patch | inline | side by side (parent: 647abae)
author | Florian Forster <octo@noris.net> | |
Wed, 22 Dec 2010 18:04:03 +0000 (19:04 +0100) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 22 Dec 2010 18:04:03 +0000 (19:04 +0100) |
share/collection.js | patch | blob | history |
diff --git a/share/collection.js b/share/collection.js
index 1a62f6e34e64a11d53b8771b027ce0f36fdaf6b4..05ca9baf80a52e2e4f56332c1655ca23991c6b9a 100644 (file)
--- a/share/collection.js
+++ b/share/collection.js
},
endOnTick: false
};
+ chart_opts.legend =
+ {
+ labelFormatter: function ()
+ {
+ var series = this;
+ var min = Number.MAX_VALUE;
+ var max = Number.NEGATIVE_INFINITY;
+ var num = 0;
+ var sum = 0;
+ var avg;
+ var i;
+
+ for (i = 0; i < this.data.length; i++)
+ {
+ var v;
+
+ v = this.data[i].y;
+ if (v == null)
+ continue;
+
+ if (min > v)
+ min = v;
+ if (max < v)
+ max = v;
+
+ sum += v;
+ num++;
+ }
+
+ if (num == 0)
+ {
+ min = null;
+ max = null;
+ avg = null;
+ }
+ else
+ {
+ avg = sum / num;
+ }
+
+ return (this.name + " (" + value_to_string (min) + " min, "
+ + value_to_string (avg) + " avg, "
+ + value_to_string (max) + " max)");
+ }
+ };
chart_opts.series = new Array ();
if (def.title)