aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js
diff options
context:
space:
mode:
authorManuel Luis SanmartĂ­n Rozada2014-08-03 18:56:23 +0200
committerPim van den Berg2014-11-14 00:10:03 +0100
commitf183804a8775d48d093103354168127849c8f717 (patch)
tree8e94f21f5192108ec4de10aa6baa5a439aa7af57 /js
parentjsrrdgraph: Fix invalid function call (diff)
downloadapt-panopticon_cgp-f183804a8775d48d093103354168127849c8f717.zip
apt-panopticon_cgp-f183804a8775d48d093103354168127849c8f717.tar.gz
apt-panopticon_cgp-f183804a8775d48d093103354168127849c8f717.tar.bz2
apt-panopticon_cgp-f183804a8775d48d093103354168127849c8f717.tar.xz
jsrrdgraph: Set original step when change time interval.
Diffstat (limited to 'js')
-rw-r--r--js/RrdCmdLine.js1
-rw-r--r--js/RrdGraph.js10
-rw-r--r--js/RrdJson.js1
3 files changed, 8 insertions, 4 deletions
diff --git a/js/RrdCmdLine.js b/js/RrdCmdLine.js
index c222498..48b3d9d 100644
--- a/js/RrdCmdLine.js
+++ b/js/RrdCmdLine.js
@@ -252,6 +252,7 @@ RrdCmdLine.prototype = {
252 break; 252 break;
253 case 'step': 253 case 'step':
254 this.graph.step = parseInt(value, 10); 254 this.graph.step = parseInt(value, 10);
255 this.graph.step_orig = this.graph.step;
255 break; 256 break;
256 case 'start': 257 case 'start':
257 case 's': 258 case 's':
diff --git a/js/RrdGraph.js b/js/RrdGraph.js
index 038668e..c2457c9 100644
--- a/js/RrdGraph.js
+++ b/js/RrdGraph.js
@@ -210,8 +210,10 @@ RrdGraphDesc.prototype.def = function (graph, vname, rrdfile, name, cf, step, st
210 this.ds_nam = name; 210 this.ds_nam = name;
211 this.cf = RrdGraphDesc.cf_conv(cf); 211 this.cf = RrdGraphDesc.cf_conv(cf);
212 212
213 if (step != undefined && step != null) 213 if (step != undefined && step != null) {
214 this.step = step; 214 this.step = step;
215 this.step_orig = step;
216 }
215 if (start != undefined && start != null) 217 if (start != undefined && start != null)
216 start_t = new RrdTime(start); 218 start_t = new RrdTime(start);
217 if (end != undefined && end != null) 219 if (end != undefined && end != null)
@@ -757,6 +759,7 @@ var RrdGraph = function (gfx, data)
757 this.watermark = null; /* watermark for graph */ 759 this.watermark = null; /* watermark for graph */
758 this.tabwidth = 40; /* tabwdith */ 760 this.tabwidth = 40; /* tabwdith */
759 this.step = 0; /* any preference for the default step ? */ 761 this.step = 0; /* any preference for the default step ? */
762 this.step_orig = 0; /* any preference for the default step ? */
760 this.setminval = Number.NaN; /* extreme values in the data */ 763 this.setminval = Number.NaN; /* extreme values in the data */
761 this.setmaxval = Number.NaN; 764 this.setmaxval = Number.NaN;
762 this.rigid = false; /* do not expand range even with values outside */ 765 this.rigid = false; /* do not expand range even with values outside */
@@ -2650,11 +2653,10 @@ RrdGraph.prototype.graph_paint_init = function()
2650 this.minval = this.setminval; 2653 this.minval = this.setminval;
2651 this.maxval = this.setmaxval; 2654 this.maxval = this.setmaxval;
2652 2655
2653 this.step = Math.max(this.step, (this.end - this.start) / this.xsize); 2656 this.step = Math.max(this.step_orig, (this.end - this.start) / this.xsize);
2654 2657
2655 for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) { 2658 for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) {
2656 this.gdes[i].step = 0; // FIXME 0? 2659 this.gdes[i].step = this.gdes[i].step_orig;
2657 this.gdes[i].step_orig = this.step;
2658 this.gdes[i].start = this.start; // FIXME SHIFT 2660 this.gdes[i].start = this.start; // FIXME SHIFT
2659// this.gdes[i].start_orig = this.start; 2661// this.gdes[i].start_orig = this.start;
2660 this.gdes[i].end = this.end; // FIXME SHIFT 2662 this.gdes[i].end = this.end; // FIXME SHIFT
diff --git a/js/RrdJson.js b/js/RrdJson.js
index 4ddcbc2..eef555c 100644
--- a/js/RrdJson.js
+++ b/js/RrdJson.js
@@ -139,6 +139,7 @@ RrdJson.prototype = {
139 break; 139 break;
140 case 'step': 140 case 'step':
141 this.graph.step = this.json.step; 141 this.graph.step = this.json.step;
142 this.graph.step_orig = this.json.step;
142 break; 143 break;
143 case 'start': 144 case 'start':
144 this.graph.start_t = new RrdTime(this.json.start); 145 this.graph.start_t = new RrdTime(this.json.start);