From: <ast...@hy...> - 2008-11-20 00:35:58
|
Author: astroganov Date: 2008-11-19 16:35:53 -0800 (Wed, 19 Nov 2008) New Revision: 11819 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=11819 Modified: trunk/web/js/lib/lib.js Log: HQ-1502 fix, reviewed by rpack; loop through chart data and round it to 3 decimal places Modified: trunk/web/js/lib/lib.js =================================================================== --- trunk/web/js/lib/lib.js 2008-11-19 23:41:55 UTC (rev 11818) +++ trunk/web/js/lib/lib.js 2008-11-20 00:35:53 UTC (rev 11819) @@ -1733,9 +1733,22 @@ // that.charts[chart].data = data; if(!data.error && data.length > 0) { - that.charts[chart].data = data[0].data; - that.charts[chart].measurementName = data[0].measurementName; - that.charts[chart].last_updated = new Date(); + that.charts[chart].data = {}; + // loop through the 'data' object and round all values to 3 decimal places + for(var i in data[0].data) { + if(typeof data[0].data[i] != 'function') + { + that.charts[chart].data[i] = []; + for(var j in data[0].data[i]) { + if(typeof data[0].data[i][j] != 'function') + { + that.charts[chart].data[i][j] = data[0].data[i][j].toFixed(3); + } + } + } + } + that.charts[chart].measurementName = data[0].measurementName; + that.charts[chart].last_updated = new Date(); } }, error: function(data){ @@ -2039,7 +2052,7 @@ } that.startRefreshCycle(); }; - + that.reset_config = function() { // reset the searchbox that.groupsearch.value = ''; |