summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Wuerthwein <fkw@ucsd.edu>2009-05-01 13:03:47 +0000
committerFrank Wuerthwein <fkw@ucsd.edu>2009-05-01 13:03:47 +0000
commit69dd31db1fb6c863b12e2af5cf5e760b41eb9303 (patch)
tree8b8f0a266a6ac40c55d18e14700c92ac4985576e
parentae5022a3cba18d4cd406383e723c6737db53a644 (diff)
Fix processing of ds_single_list and fix a few typos
-rw-r--r--src/lib/rrdFlotSupport.js34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/rrdFlotSupport.js b/src/lib/rrdFlotSupport.js
index e0162f4..ec460fd 100644
--- a/src/lib/rrdFlotSupport.js
+++ b/src/lib/rrdFlotSupport.js
@@ -129,7 +129,7 @@ function rrdRRAStackFlotObj(rrd_file,rra_idx,
var ds=rrd_file.getDS(ds_id);
var ds_name=ds.getName();
var ds_idx=ds.getIdx();
- tmp_ds_ids.append(ds_idx); // getting this is expensive, call only once
+ tmp_ds_ids.push(ds_idx); // getting this is expensive, call only once
// initialize
var flot_el={data:[]}
@@ -137,7 +137,7 @@ function rrdRRAStackFlotObj(rrd_file,rra_idx,
var ds_name=ds.getName();
flot_el.label= ds_name;
}
- tmp_flot_els.append(flot_el);
+ tmp_flot_els.push(flot_el);
}
var timestamp=first_el;
@@ -150,21 +150,21 @@ function rrdRRAStackFlotObj(rrd_file,rra_idx,
var el=rra.getEl(row,ds_idx);
if (el!=undefined) {
all_undef=false;
- ds_val.push(el);
+ ds_vals.push(el);
} else {
all_def=false;
- ds_val.push(0);
+ ds_vals.push(0);
}
} // end for id
if (!all_undef) { // if all undefined, skip
if (all_def || (!one_undefined_enough)) {
// this is a valid column, do the math
for (var id=1; id<tmp_nr_ids; id++) {
- ds_val[id]+=ds_val[id-1]; // both positive and negative stack use a +, negative stack assumes negative values
+ ds_vals[id]+=ds_vals[id-1]; // both positive and negative stack use a +, negative stack assumes negative values
}
// fill the flot data
for (var id=0; id<tmp_nr_ids; id++) {
- tmp_flot_els[id].data.push([timestamp*1000.0,ds_val[id]]);
+ tmp_flot_els[id].data.push([timestamp*1000.0,ds_vals[id]]);
}
}
} // end if
@@ -179,17 +179,16 @@ function rrdRRAStackFlotObj(rrd_file,rra_idx,
}
} //end for stack_list_id
- for (var row=0;row<rra_rows;row++) {
- for (ds_list_idx in ds_single_list) {
- var ds_id=ds_single_list[ds_list_idx];
- var ds=rrd_file.getDS(ds_id);
- var ds_name=ds.getName();
- var ds_idx=ds.getIdx();
-
- var timestamp=first_el;
- var flot_series=[];
+ for (ds_list_idx in ds_single_list) {
+ var ds_id=ds_single_list[ds_list_idx];
+ var ds=rrd_file.getDS(ds_id);
+ var ds_name=ds.getName();
+ var ds_idx=ds.getIdx();
- var el=rra.getEl(row,ds_idx);
+ var timestamp=first_el;
+ var flot_series=[];
+ for (var i=0;i<rra_rows;i++) {
+ var el=rra.getEl(i,ds_idx);
if (el!=undefined) {
flot_series.push([timestamp*1000.0,el]);
}
@@ -202,7 +201,8 @@ function rrdRRAStackFlotObj(rrd_file,rra_idx,
flot_el.label= ds_name;
}
out_el.data.push(flot_el);
- } //end for row
+ } //end for ds_list_idx
+
return out_el;
}