[Reconnoiter-devel] [reconnoiter commit] r759 - in trunk/ui/web/htdocs: . js

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Wed Jun 17 16:38:20 EDT 2009


Author: umar
Date: 2009-06-17 16:38:19 -0400 (Wed, 17 Jun 2009)
New Revision: 759

Modified:
   trunk/ui/web/htdocs/graph_panel.inc
   trunk/ui/web/htdocs/js/jquery.flot.js
   trunk/ui/web/htdocs/js/recon.js
Log:
keep a copy of unstacked data so it works correctly, polltime increased to 2secs to cut down on spiking when graphing derived or counter values, refs #144

Modified: trunk/ui/web/htdocs/graph_panel.inc
===================================================================
--- trunk/ui/web/htdocs/graph_panel.inc	2009-06-16 17:24:03 UTC (rev 758)
+++ trunk/ui/web/htdocs/graph_panel.inc	2009-06-17 20:38:19 UTC (rev 759)
@@ -58,7 +58,7 @@
 
 function graph_stream_data() {
 
-polltime = 1000;
+polltime = 2000;
 time_width = 300000;
 stream_object = maingraph;
 stream_dirty = false;
@@ -76,7 +76,7 @@
     sids+= "/"+sid+"@"+sidneed[sid];
 }
 
-maingraph.everyTime(1000, function() {
+maingraph.everyTime(2000, function() {
 			  
     if(!gstreaming) {   
        $('#gstreambox').html('');

Modified: trunk/ui/web/htdocs/js/jquery.flot.js
===================================================================
--- trunk/ui/web/htdocs/js/jquery.flot.js	2009-06-16 17:24:03 UTC (rev 758)
+++ trunk/ui/web/htdocs/js/jquery.flot.js	2009-06-17 20:38:19 UTC (rev 759)
@@ -9,7 +9,6 @@
         //   [ series1, series2 ... ]
         // where series is either just the data as [ [x1, y1], [x2, y2], ... ]
         // or { data: [ [x1, y1], [x2, y2], ... ], label: "some label" }
-        var orig_series;
 
         var series = [],
             options = {
@@ -130,7 +129,6 @@
 
 
         function setData(d) {
-	    orig_series = copyData(d);
 
             series = parseData(d);
 		    
@@ -167,7 +165,7 @@
 		    match = binary_search(bdata, series[i].data[j][0], bdata.length-1, 0);			
 		    
 		    //if the dataset below this one has an exact timestamp match, stack the top dataset by adding it to the one above
-		    if(match.found) { 		
+		    if(match.found) { 
 			series[i].data[j][1] = parseFloat(series[i].data[j][1]) + parseFloat(bdata[match.index][1])+'';
 		    }
 		    else if(match.index >=0 && match.index<bdata.length) {
@@ -212,30 +210,6 @@
 	}
 
 	
-	//this will copy data only, ignoring other series variables
-        function copyData(d) {  
-	    var res = [];
-
-	    for (var i = 0; i < d.length; ++i) {
-		var s = {data: []};
-		if(d[i].data) {
-		    for (var j=0; j<d[i].data.length; j++) {
-			s.data[j] = d[i].data[j].slice();
-		    }
-		    for (var v in d[i]) {
-                        if(!s[v]) s[v] = d[i][v];
-		    }
-		}
-		else {		    
-		    for (var j=0; j<d[i].length; j++) {
-			s.data[j] = d[i][j].slice();
-		    }
-		}
-		res.push(s);
-	    }
-	    return res;
-	}
-
 	//this creates a new refernce to data
 	function parseData(d) {
             var res = [];

Modified: trunk/ui/web/htdocs/js/recon.js
===================================================================
--- trunk/ui/web/htdocs/js/recon.js	2009-06-16 17:24:03 UTC (rev 758)
+++ trunk/ui/web/htdocs/js/recon.js	2009-06-17 20:38:19 UTC (rev 759)
@@ -17,6 +17,31 @@
     $(".stream-log").html(message).fadeIn('slow');
 }
 
+
+//this will copy data only, ignoring other series variables
+function copyData(d) {  
+    var res = [];
+    
+    for (var i = 0; i < d.length; ++i) {
+	var s = {data: []};
+	if(d[i].data) {
+	    for (var j=0; j<d[i].data.length; j++) {
+		s.data[j] = d[i].data[j].slice();
+	    }
+	    for (var v in d[i]) {
+		if(!s[v]) s[v] = d[i][v];
+	    }
+	}
+	else {		    
+	    for (var j=0; j<d[i].length; j++) {
+		s.data[j] = d[i][j].slice();
+	    }
+	}
+	res.push(s);
+    }
+    return res;
+}
+
 function dump(arr,level) {
 	var dumped_text = "";
 	if(!level) level = 0;
@@ -259,6 +284,7 @@
 			}
 			} //end if ydata was a number
 			
+
 			tdata[0]*=1000; //convert from seconds to milliseconds for flot
 			ddata[i].data.push(tdata);
 			if(ddata[i].lastval) {
@@ -313,7 +339,8 @@
 		doptions.xaxis.max = doptions.min_time + doptions.time_window;
 	    }
 
-            this.flot_plot = $.plot(dplaceholder, ddata, doptions);
+	    flotdata = copyData(ddata);
+            this.flot_plot = $.plot(dplaceholder, flotdata, doptions);
             return this;
 	},
     refresh:
@@ -720,7 +747,7 @@
 
   function stream_data(graph_id) {
 
-    polltime = 1000;
+    polltime = 2000;
     timewindow = 300000;
     stream_object = stream_graph;
     stream_dirty = false;
@@ -728,8 +755,8 @@
 
     streaming = true;
 
-//setup functionality so that every second check if we are streaming and dirty, plot if true
-    stream_graph.everyTime(1000, function() {
+//setup functionality so that every 2 seconds check if we are streaming and dirty, plot if true
+    stream_graph.everyTime(2000, function() {
       if(!streaming) {
        $('#streambox').html('');
        $(".stream-log").attr("style", "display:none;");
@@ -758,7 +785,6 @@
           sids+= "/"+sid+"@"+sidneed[sid];
         }
 	//console.log("sids request: http://" +recon_realtime_hostname+"/data"+sids);
-
 	$('#streambox').html('<iframe src="http://' + recon_realtime_hostname + '/data'+sids+'"></iframe>');
      });
   }
@@ -871,7 +897,7 @@
                   </div>');
 
     var mheader = $("<div id='stream-header'>").append(dtool);
-    mheader.append("<span class='streamData'>Stream Data</span>");
+    mheader.append("<span class='streamData'>Stream Data</span><br/>");
     stream_graph.prepend(mheader);
     stream_graph.append('<div id="streambox" style="display:none"></div>');
     stream_graph.append("<div class='stream-log' style='display:none'></div>");



More information about the Reconnoiter-devel mailing list