diff options
author | Frank Wuerthwein <fkw@ucsd.edu> | 2009-02-20 03:15:57 +0000 |
---|---|---|
committer | Frank Wuerthwein <fkw@ucsd.edu> | 2009-02-20 03:15:57 +0000 |
commit | 85e0b61e3d69f1412f0725e57678fe4bc0edffc3 (patch) | |
tree | b2ab46117308d4785cd9c64eac300674869a6401 /src/lib/rrdFlotSupport.js | |
parent | 55cca35ef38c4972a1c99ba8f3a490f9c070a3b5 (diff) |
Flot does not like null elements, so don't use them. But now we need to pass back the min and max values we want to plot
Diffstat (limited to 'src/lib/rrdFlotSupport.js')
-rw-r--r-- | src/lib/rrdFlotSupport.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/rrdFlotSupport.js b/src/lib/rrdFlotSupport.js index dc12f89..7461da2 100644 --- a/src/lib/rrdFlotSupport.js +++ b/src/lib/rrdFlotSupport.js @@ -25,21 +25,21 @@ function rrdDS2FlotSeries(rrd_file,ds_id,rra_idx,want_label) { var last_update=rrd_file.getLastUpdate();
var step=rra.getStep();
+ var first_el=(last_update-rra_rows+1)*step;
+ var timestamp=first_el;
var flot_series=[];
for (var i=0;i<rra_rows;i++) {
- var timestamp=(last_update+(i-rra_rows+1)*step)*1000.0;
var el=rra.getEl(i,ds_idx);
if (el!=undefined) {
- flot_series.push([timestamp,el]);
- } else {
- flot_series.push([timestamp,null]);
- }
+ flot_series.push([timestamp*1000.0,el]);
+ }
+ timestamp+=step;
} // end for
if (want_label!=false) {
- return {label: ds_name, data: flot_series};
+ return {label: ds_name, data: flot_series, min: first_el*1000.0, max:timestamp*1000.0};
} else {
- return {data:flot_series};
+ return {data:flot_series, min: first_el*1000.0, max:timestamp*1000.0};
}
}
|