From 39fa4b2381ddabef6afd797ebb1a0f9f3d3080fc Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Sun, 14 Aug 2011 08:16:33 +0100 Subject: check for existing DEF --- docs/examples/assets/js/jsrrdgraph.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/examples/assets/js/jsrrdgraph.js b/docs/examples/assets/js/jsrrdgraph.js index a7d0b9e..7dfdcad 100644 --- a/docs/examples/assets/js/jsrrdgraph.js +++ b/docs/examples/assets/js/jsrrdgraph.js @@ -4220,7 +4220,7 @@ RRDGraph.prototype = { for (var j = n, xlen = args.length ; j < xlen ; j++) { var opts = args[j].split("="); if (opts[0] === "step") step = opts[1]; - if (opts[0] === "reduce") reduce = opts[1] + if (opts[0] === "reduce") reduce = opts[1]; if (opts[0] === "start") start = opts[1]; if (opts[0] === "end") end = opts[1]; } @@ -4229,7 +4229,7 @@ RRDGraph.prototype = { }, create_def: function (vname, rrdfile, name, cf, step, start, end, reduce) { - var gdp = new RRDGraphDesc(this); + var gdp = new RRDGraphDesc(this); var start_t = new RRDTime(this.start); var end_t = new RRDTime(this.end); @@ -4293,9 +4293,11 @@ RRDGraph.prototype = { var index = rpn.indexOf(','); var name = rpn.substring(0,index); gdp.vidx = this.find_var(name); // FIXME checks - if (this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.DEF && this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.CDEF) { + if (gdp.vidx === -1 + || this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.DEF + && this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.CDEF) { throw 'variable "'+name+'" not DEF nor CDEF in VDEF.'; - } + } this.vdef_parse(gdp, rpn.substring(index+1)); @@ -4451,7 +4453,7 @@ RRDGraph.prototype = { gdp.format = format; } // if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && gdp.strftm === true) // FIXME - if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && strtime === true) // FIXME + if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && strftime === true) // FIXME gdp.strftm = true; this.gdes.push(gdp); }, -- cgit v1.1-4-g5e80