aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js/RrdCmdLine.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/RrdCmdLine.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/js/RrdCmdLine.js b/js/RrdCmdLine.js
index ceec693..a2be92e 100644
--- a/js/RrdCmdLine.js
+++ b/js/RrdCmdLine.js
@@ -184,6 +184,8 @@ RrdCmdLine.prototype = {
184 }, 184 },
185 set_option: function(option, value) 185 set_option: function(option, value)
186 { 186 {
187 var args = value.split(':');
188 var index = value.indexOf(':');
187 switch(option) { 189 switch(option) {
188 case 'base': 190 case 'base':
189 case 'b': 191 case 'b':
@@ -193,12 +195,12 @@ RrdCmdLine.prototype = {
193 break; 195 break;
194 case 'color': 196 case 'color':
195 case 'c': 197 case 'c':
196 var index = value.indexOf('#'); 198 index = value.indexOf('#');
197 if (index === -1) 199 if (index === -1)
198 throw "invalid color def format"; 200 throw "invalid color def format";
199 var name = value.substr(0,index); 201 var name = value.substr(0,index);
200 if (!this.graph.GRC[name]) 202 if (!this.graph.GRC[name])
201 throw "invalid color name '"+name+"'" 203 throw "invalid color name '" + name + "'";
202 this.graph.GRC[name] = value.substr(index); // FIXME check color 204 this.graph.GRC[name] = value.substr(index); // FIXME check color
203 break; 205 break;
204 case 'end': 206 case 'end':
@@ -212,7 +214,7 @@ RrdCmdLine.prototype = {
212 break; 214 break;
213 case 'graph-render-mode': 215 case 'graph-render-mode':
214 case 'G': 216 case 'G':
215 // im->graph_antialias 217 // im->graph_antialias
216 break; 218 break;
217 case 'height': 219 case 'height':
218 case 'h': 220 case 'h':
@@ -225,7 +227,7 @@ RrdCmdLine.prototype = {
225 break; 227 break;
226 case 'lower-limit': 228 case 'lower-limit':
227 case 'l': 229 case 'l':
228 this.graph.setminval = parseFloat(value) 230 this.graph.setminval = parseFloat(value);
229 break; 231 break;
230 case 'zoom': 232 case 'zoom':
231 case 'm': 233 case 'm':
@@ -235,11 +237,10 @@ RrdCmdLine.prototype = {
235 break; 237 break;
236 case 'font': 238 case 'font':
237 case 'n': 239 case 'n':
238 var args = value.split(':');
239 if (args.length !== 3) 240 if (args.length !== 3)
240 throw "invalid text property format"; 241 throw "invalid text property format";
241 if (!this.graph.TEXT[args[0]]) 242 if (!this.graph.TEXT[args[0]])
242 throw "invalid fonttag '"+args[0]+"'" 243 throw "invalid font tag '" + args[0] + "'";
243 if (args[1] > 0) 244 if (args[1] > 0)
244 this.graph.TEXT[args[0]].size = args[1]; 245 this.graph.TEXT[args[0]].size = args[1];
245 if (args[2]) 246 if (args[2])
@@ -292,7 +293,6 @@ RrdCmdLine.prototype = {
292 if (value === 'none') { 293 if (value === 'none') {
293 this.graph.draw_x_grid = false; 294 this.graph.draw_x_grid = false;
294 } else { 295 } else {
295 var args = value.split(':');
296 if (args.length !== 8) 296 if (args.length !== 8)
297 throw "invalid x-grid format"; 297 throw "invalid x-grid format";
298 this.graph.xlab_user.gridtm = this.graph.tmt_conv(args[0]); 298 this.graph.xlab_user.gridtm = this.graph.tmt_conv(args[0]);
@@ -318,7 +318,6 @@ RrdCmdLine.prototype = {
318 if (value === 'none') { 318 if (value === 'none') {
319 this.graph.draw_y_grid = false; 319 this.graph.draw_y_grid = false;
320 } else { 320 } else {
321 var index = value.indexOf(':');
322 if (index === -1) 321 if (index === -1)
323 throw "invalid y-grid format"; 322 throw "invalid y-grid format";
324 this.graph.ygridstep = parseFloat(value.substr(0,index)); 323 this.graph.ygridstep = parseFloat(value.substr(0,index));
@@ -338,7 +337,6 @@ RrdCmdLine.prototype = {
338 throw "invalid argument for --units: "+value; 337 throw "invalid argument for --units: "+value;
339 break; 338 break;
340 case 'right-axis': 339 case 'right-axis':
341 var index = value.indexOf(':');
342 if (index === -1) 340 if (index === -1)
343 throw "invalid right-axis format expected scale:shift"; 341 throw "invalid right-axis format expected scale:shift";
344 this.graph.second_axis_scale = parseFloat(value.substr(0,index)); 342 this.graph.second_axis_scale = parseFloat(value.substr(0,index));
@@ -378,7 +376,6 @@ RrdCmdLine.prototype = {
378 this.graph.draw_3d_border = parseInt(value, 10); 376 this.graph.draw_3d_border = parseInt(value, 10);
379 break; 377 break;
380 case 'grid-dash': 378 case 'grid-dash':
381 var index = value.indexOf(':');
382 if (index === -1) 379 if (index === -1)
383 throw "expected grid-dash format float:float"; 380 throw "expected grid-dash format float:float";
384 this.graph.grid_dash_on = parseFloat(value.substr(0,index)); 381 this.graph.grid_dash_on = parseFloat(value.substr(0,index));
@@ -399,20 +396,17 @@ RrdCmdLine.prototype = {
399 var rrdfile = vnames[1]; 396 var rrdfile = vnames[1];
400 var name = args[n++]; 397 var name = args[n++];
401 var cf = args[n++]; 398 var cf = args[n++];
402 var step = undefined; 399 var step, reduce, start, end;
403 var reduce = undefined;
404 var start = undefined;
405 var end = undefined;
406 if (args.length > n) { 400 if (args.length > n) {
407 for (var j = n, xlen = args.length ; j < xlen ; j++) { 401 for (var j = n, xlen = args.length ; j < xlen ; j++) {
408 var opts = args[j].split("="); 402 var opts = args[j].split("=");
409 if (opts[0] === "step") step = opts[1]; 403 if (opts[0] === "step") step = opts[1];
410 if (opts[0] === "reduce") reduce = opts[1] 404 if (opts[0] === "reduce") reduce = opts[1];
411 if (opts[0] === "start") start = opts[1]; 405 if (opts[0] === "start") start = opts[1];
412 if (opts[0] === "end") end = opts[1]; 406 if (opts[0] === "end") end = opts[1];
413 } 407 }
414 } 408 }
415 this.graph.gdes_add_def(vname, rrdfile, name, cf, step, start, end, reduce) 409 this.graph.gdes_add_def(vname, rrdfile, name, cf, step, start, end, reduce);
416 }, 410 },
417 // CDEF:vname=RPN expression 411 // CDEF:vname=RPN expression
418 parse_cdef: function (line) 412 parse_cdef: function (line)