Module: nagvis Branch: master Commit: 01511c381656fbe93ed37f668cc7755d2a33581f URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=01511c381656fbe93ed37f668cc7755d2a33581f
Author: Lars Michelsen <[email protected]> Date: Thu Nov 4 11:14:58 2010 +0100 #389 Weathermap line labels show up 0% usage correctly --- share/frontend/nagvis-js/js/lines.js | 12 ++++++------ share/frontend/nagvis-js/js/nagvis.js | 10 +++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/share/frontend/nagvis-js/js/lines.js b/share/frontend/nagvis-js/js/lines.js index d905317..dca1cb6 100644 --- a/share/frontend/nagvis-js/js/lines.js +++ b/share/frontend/nagvis-js/js/lines.js @@ -258,12 +258,12 @@ function drawNagVisLine(objectId, lineType, cuts, x1, y1, x2, y2, z, width, colo var xMid = middle(x1, x2, cut); var yMid = middle(y1, y2, cut); // perfdataA contains the percentage info - if(perfdata[0] && perfdata[0][1] && perfdata[0][2]) + if(isset(perfdata[0]) && isset(perfdata[0][1]) && isset(perfdata[0][2])) perfdataA = perfdata[0][1] + perfdata[0][2]; drawArrow(objectId, x1, y1, xMid, yMid, z, width, colorFill, colorBorder); drawLinkOrLabel(objectId, lineType, x1, y1, xMid, yMid, z, perfdataA, perfdataB, cutIn, bLinkArea, bLabelShow); - if(perfdata[1] && perfdata[1][1] && perfdata[1][2]) + if(isset(perfdata[1]) && isset(perfdata[1][1]) && isset(perfdata[1][2])) perfdataA = perfdata[1][1] + perfdata[1][2]; drawArrow(objectId, x2, y2, xMid, yMid, z, width, colorFill2, colorBorder); drawLinkOrLabel(objectId, lineType, x2, y2, xMid, yMid, z, perfdataA, perfdataB, cutOut, bLinkArea, bLabelShow); @@ -274,16 +274,16 @@ function drawNagVisLine(objectId, lineType, cuts, x1, y1, x2, y2, z, width, colo var yMid = middle(y1, y2, cut); // perfdataA contains the percentage info // perfdataB contains the bandwith info - if(perfdata[0] && perfdata[0][1] && perfdata[0][2]) + if(isset(perfdata[0]) && isset(perfdata[0][1]) && isset(perfdata[0][2])) perfdataA = perfdata[0][1] + perfdata[0][2]; - if(perfdata[2] && perfdata[2][1] && perfdata[2][2]) + if(isset(perfdata[2]) && isset(perfdata[2][1]) && isset(perfdata[2][2])) perfdataB = perfdata[2][1] + perfdata[2][2]; drawArrow(objectId, x1, y1, xMid, yMid, z, width, colorFill, colorBorder); drawLinkOrLabel(objectId, lineType, x1, y1, xMid, yMid, z, perfdataA, perfdataB, cutOut, bLinkArea, bLabelShow); - if(perfdata[1] && perfdata[1][1] && perfdata[1][2]) + if(isset(perfdata[1]) && isset(perfdata[1][1]) && isset(perfdata[1][2])) perfdataA = perfdata[1][1] + perfdata[1][2]; - if(perfdata[3] && perfdata[3][1] && perfdata[3][2]) + if(isset(perfdata[3]) && isset(perfdata[3][1]) && isset(perfdata[3][2])) perfdataB = perfdata[3][1] + perfdata[3][2]; drawArrow(objectId, x2, y2, xMid, yMid, z, width, colorFill2, colorBorder); drawLinkOrLabel(objectId, lineType, x2, y2, xMid, yMid, z, perfdataA, perfdataB, cutIn, bLinkArea, bLabelShow); diff --git a/share/frontend/nagvis-js/js/nagvis.js b/share/frontend/nagvis-js/js/nagvis.js index 37fd959..4d053f2 100644 --- a/share/frontend/nagvis-js/js/nagvis.js +++ b/share/frontend/nagvis-js/js/nagvis.js @@ -1006,4 +1006,12 @@ function lightenColor(code, rD, gD, bD) { return "#" + code.toUpperCase(); } - + +/** + * Checks if a variable is set + * + * @author Lars Michelsen <[email protected]> + */ +function isset(v) { + return typeof(v) !== 'undefined'; +} ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
