Changeset 3db67ae5b26eab5ce769c235b8a2e672325cadb7
 Timestamp:
 07/10/09 19:45:23
(5 years ago)
 Author:
 Umar Farooq <umar@omniti.com>
 gitcommitter:
 Umar Farooq <umar@omniti.com> 1247255123 +0000
 gitparent:
[06519e0d896bfca30746212670c342a1b84a74a5]
 gitauthor:
 Umar Farooq <umar@omniti.com> 1247255123 +0000
 Message:
fixing bug caused when stacking streaming datasets that are missing some data, and removing some unused streaming code

Files:

Legend:
 Unmodified
 Added
 Removed
 Modified
 Copied
 Moved
r7c60f54 
r3db67ae 

162  162  

163  163  for (var j = 0; j < series[i].data.length; j++) { 

164   if(series[i].data[j][1] && bdata[j][1]){ 

 164  if(series[i].data[j] && bdata[j]){ 

 165  

165  166  match = binary_search(bdata, series[i].data[j][0], bdata.length1, 0); 

166  167  

167  168  //if the dataset below this one has an exact timestamp match, stack the top dataset by adding it to the one above 

168  169  if(match.found) { 

169   series[i].data[j][1] = parseFloat(series[i].data[j][1]) + parseFloat(bdata[match.index][1])+''; 

 170  my1 = ( isNaN(parseFloat(series[i].data[j][1])) ) ? 0 : parseFloat(series[i].data[j][1]); 

 171  my2 = ( isNaN(parseFloat(bdata[match.index][1])) )? 0 : parseFloat(bdata[match.index][1]); 

 172  series[i].data[j][1] = my1 + my2 +''; 

170  173  } 

171  174  else if(match.index >=0 && match.index<bdata.length) { 

…  …  
206  209  //this will lerp to the y value at x=t using points p1 and p2 

207  210  function interpolate(p1, p2, t) { 

208   dx = p2[0]  p1[0]; dy = p2[1]  p1[1]; 

209   return (dy/dx)*(tp1[0]) + p1[1]; 

 211  mp1 = [ isNaN(parseFloat(p1[0])) ? 0 : parseFloat(p1[0]), 

 212  isNaN(parseFloat(p1[1])) ? 0 : parseFloat(p1[1]) ]; 

 213  

 214  mp2 = [ isNaN(parseFloat(p2[0])) ? 0 : parseFloat(p2[0]), 

 215  isNaN(parseFloat(p2[1])) ? 0 : parseFloat(p2[1]) ]; 

 216  

 217  dx = mp2[0]  mp1[0]; dy = mp2[1]  mp1[1]; 

 218  return (dy/dx)*(tmp1[0]) + mp1[1]; 

210  219  } 

211  220  

…  …  
1257  1266  

1258  1267  var prev, cur = null; 

1259   var bprev, bcur = null; 

1260  1268  

1261  1269  //zero negative ymin, then find minimum of that and ymax for bottom 

…  …  
1265  1273  var areaOpen = false; 

1266  1274  var pcount = 0; 

1267   var last_by = (b_series ? (b_series.data[b_series.data.length1][1] ? b_series.data[b_series.data.length1][1] : bottom) : bottom); 

1268   var first_by = (b_series ? (b_series.data[0][1] ? b_series.data[0][1] : bottom) : bottom); 

 1275  var last_by = bottom; 

 1276  var first_by = bottom; 

 1277  

 1278  if(b_series) { 

 1279  

 1280  if(b_series.data[b_series.data.length1]) last_by = b_series.data[b_series.data.length1][1]; 

 1281  else last_by = bottom; 

 1282  

 1283  if(b_series.data[0]) first_by = b_series.data[0][1]; 

 1284  else first_by = bottom; 

 1285  } 

1269  1286  

1270  1287  for (var i = 0; i < data.length; ++i) { 

1271  1288  prev = cur; 

1272  1289  cur = [data[i][0], data[i][1]]; 

1273   if(b_series){ 

1274   bprev = bcur; 

1275   bcur = [parseFloat(b_series.data[i][0]), parseFloat(b_series.data[i][1])]; 

1276   } 

1277   else { 

1278   bprev = axisy.min; 

1279   bcur = axisy.min; 

1280   } 

1281   

1282   if(dataManip) cur[1] = dataManip(cur[1]); 

1283  1290  

1284  1291  //close only if not stacked 

…  …  
1293  1300  if (prev == null  cur == null) 

1294  1301  continue; 

1295   

 1302  

 1303  if(dataManip) cur[1] = dataManip(cur[1]); 

 1304  

1296  1305  var x1 = prev[0], y1 = prev[1], 

1297  1306  x2 = cur[0], y2 = cur[1]; 

1298   var bx1 = bprev[0], by1 = bprev[1], 

1299   bx2 = bcur[0], by2 = bcur[1]; 

1300   

1301  1307  

1302  1308  // clip x values 

re2f1fa4 
r3db67ae 

329  329  && !ddata[i].hidden ) { 

330  330  

331   // console.log("got data from stream for ",uuid,"",metric_name," data = ",tdata, "hidden = ", ddata[i].hidden); 

 331  //console.log("got data from stream for ",uuid,"",metric_name," data = ",tdata, "hidden = ", ddata[i].hidden); 

332  332  

333  333  if((xdata*1000)>doptions.max_time) { doptions.max_time = xdata*1000; } 

…  …  
354  354  if(ddata[i].reconnoiter_source_expression) { 

355  355  tdata[1] = rpn_eval(tdata[1], ddata[i].reconnoiter_source_expression, {}); 

 356  } 

 357  } //end if ydata was a number 

 358  else { //we need to fix this so we can do numerical calcs with this val later 

 359  tdata[1] = 0; 

356  360  } 

357   } //end if ydata was a number 

358   

359  361  

360  362  tdata[0]*=1000; //convert from seconds to milliseconds for flot 

 363  

361  364  ddata[i].data.push(tdata); 

362  365  if(ddata[i].lastval) { 
