summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Schwaer2016-03-16 14:06:09 +0100
committerStephan Schwaer2016-03-16 14:06:09 +0100
commit55ca54d2ff84dac1e47885f5e991fb7709e5f45f (patch)
tree31e54419777a417fc9f86dc14880319544e08ff8
parentCode cleanup and some comments. (diff)
downloaddnbd3-status-55ca54d2ff84dac1e47885f5e991fb7709e5f45f.tar.gz
dnbd3-status-55ca54d2ff84dac1e47885f5e991fb7709e5f45f.tar.xz
dnbd3-status-55ca54d2ff84dac1e47885f5e991fb7709e5f45f.zip
Fixed resize of window.
-rw-r--r--static/status-dnbd3.html18
1 files changed, 13 insertions, 5 deletions
diff --git a/static/status-dnbd3.html b/static/status-dnbd3.html
index 16bc17e..0a9556e 100644
--- a/static/status-dnbd3.html
+++ b/static/status-dnbd3.html
@@ -185,7 +185,7 @@ function myGraph(el) {
// Green colors between 0 - 1 MB/s
if( link.colorIntensity <= 1000 ) {
// Blending idle (blue) and active (green) color
- var factor = link.colorIntensity / 1000; //Math.log(link.colorIntensity+1) / Math.log(maxIntensity);
+ var factor = link.colorIntensity / 1000;
var cFactor = 1 - factor;
red = cFactor * idleColor.r + factor * activeColor.r;
@@ -194,7 +194,7 @@ function myGraph(el) {
} else { // Red over 1MB/s
// Blending active (green) and peak (red) color
- var factor = (link.colorIntensity - 1000)/ (maxIntensity - 1000); //Math.log(link.colorIntensity+1) / Math.log(maxIntensity);
+ var factor = (link.colorIntensity - 1000)/ (maxIntensity - 1000);
var cFactor = 1 - factor;
red = cFactor * activeColor.r + factor * peakColor.r;
@@ -278,7 +278,8 @@ function myGraph(el) {
update();
}
- var update = function () {
+
+ function update () {
var link = vis.selectAll("line.link")
.data(links, function(d) { return d.source.id + "-" + d.target.id; });
@@ -387,9 +388,16 @@ function myGraph(el) {
}
}
- update();
- $( window ).resize( update );
+
+ window.onresize = forceUpdate;
+
+ function forceUpdate () {
+ changed = true;
+ update();
+ }
+ forceUpdate();
}
+
graph = new myGraph("#graph");