From 55ca54d2ff84dac1e47885f5e991fb7709e5f45f Mon Sep 17 00:00:00 2001 From: Stephan Schwaer Date: Wed, 16 Mar 2016 14:06:09 +0100 Subject: Fixed resize of window. --- static/status-dnbd3.html | 18 +++++++++++++----- 1 file 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"); -- cgit v1.2.3-55-g7522