diff options
-rw-r--r-- | docs/examples/assets/js/jsrrdgraph.js | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/docs/examples/assets/js/jsrrdgraph.js b/docs/examples/assets/js/jsrrdgraph.js index d0cc418..7e99ea7 100644 --- a/docs/examples/assets/js/jsrrdgraph.js +++ b/docs/examples/assets/js/jsrrdgraph.js @@ -583,7 +583,7 @@ RRDTime.prototype = { var date = new Date(this.tm_year+1900, this.tm_mon, this.tm_mday, this.tm_hour, this.tm_min, this.tm_sec); return Math.round(date.getTime()/1000.0); } -} +}; RRDTime.proc_start_end = function(start_t, end_t) { var start, end; @@ -616,7 +616,7 @@ RRDTime.proc_start_end = function(start_t, end_t) { end = end_t.mktime() + end_t.offset; } return [start, end]; -} +}; var RRDRpn = function() { this.parser.apply(this, arguments); @@ -1150,7 +1150,7 @@ RRDRpn.prototype = { output[output_idx] = this.rpnstack[0]; return 0; } -} +}; var RRDGraphDesc = function() { this.init.apply(this, arguments); @@ -1227,21 +1227,30 @@ RRDGraphDesc.prototype = { this.pdata = []; this.ds_namv = []; } -} +}; Date.prototype.getWeek = function() { var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7); -} +}; var RRDGraph = function() { this.init.apply(this, arguments); }; -RRDGraph.pad2 = function(number) { return (number < 10 ? '0' : '') + number }; -RRDGraph.pad3 = function(number) { return (number < 10 ? '00' : number < 100 ? '0' : '') + number }; -RRDGraph.lpad = function(str, padString, length) { while (str.length < length) str = padString + str; return str; }; +RRDGraph.pad2 = function(number) { + return (number < 10 ? '0' : '') + number; +}; +RRDGraph.pad3 = function(number) { + return (number < 10 ? '00' : number < 100 ? '0' : '') + number; +}; +RRDGraph.lpad = function(str, padString, length) { + while (str.length < length) { + str = padString + str; + } + return str; +}; RRDGraph.days = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]; RRDGraph.fdays = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; RRDGraph.months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; @@ -1466,7 +1475,7 @@ RRDGraph.prototype = { throw "invalid color def format"; var name = value.substr(0,index); if (!this.GRC[name]) - throw "invalid color name '"+name+"'" + throw "invalid color name '"+name+"'"; this.GRC[name] = value.substr(index); // FIXME check color break; case 'full-size-mode': @@ -1524,7 +1533,7 @@ RRDGraph.prototype = { break; case 'lower-limit': case 'l': - this.setminval = parseFloat(value) + this.setminval = parseFloat(value); break; case 'alt-autoscale-max': case 'M': @@ -1546,7 +1555,7 @@ RRDGraph.prototype = { if (args.length !== 3) throw "invalid text property format"; if (!this.TEXT[args[0]]) - throw "invalid fonttag '"+args[0]+"'" + throw "invalid fonttag '"+args[0]+"'"; if (args[1] > 0) this.TEXT[args[0]].size = args[1]; if (args[2]) @@ -1943,7 +1952,7 @@ RRDGraph.prototype = { case 'W': // FIXME weeks break; case 'x': - return RRDGraph.pad2(d.getDate())+'/'+RRDGraph.pad2(d.getMonth())+'/'+d.getFullYear() + return RRDGraph.pad2(d.getDate())+'/'+RRDGraph.pad2(d.getMonth())+'/'+d.getFullYear(); break; case 'X': return RRDGraph.pad2(d.getHours())+':'+RRDGraph.pad2(d.getMinutes())+':'+RRDGraph.pad2(d.getSeconds()); @@ -1980,7 +1989,7 @@ RRDGraph.prototype = { this.ctx.save(); this.ctx.lineWidth = width; - this.ctx.strokeStyle = color + this.ctx.strokeStyle = color; this.ctx.beginPath(); this.ctx.moveTo(X0, Y0); this.ctx.lineTo(X1, Y1); @@ -2878,7 +2887,7 @@ RRDGraph.prototype = { if (this.gdes[i].gf === RRDGraphDesc.GF.VRULE && (this.gdes[i].xrule < this.start || this.gdes[i].xrule > this.end)) this.gdes[i].legend = null; } - this.gdes[i].legend = this.gdes[i].legend.replace(/\\t/gi, "\t") /* turn \\t into tab */ + this.gdes[i].legend = this.gdes[i].legend.replace(/\\t/gi, "\t"); /* turn \\t into tab */ leg_cc = this.gdes[i].legend.length; /* is there a controle code at the end of the legend string ? */ @@ -3584,7 +3593,7 @@ RRDGraph.prototype = { } /* graph watermark */ if (this.watermark) { - var color = this.parse_color(this.GRC.FONT) + var color = this.parse_color(this.GRC.FONT); color[3] = 0.3; var water_color = this.color2rgba(color); this.gfx_text(this.ximg / 2, this.yimg - 6, water_color, this.TEXT.FONT , this.tabwidth, 0, @@ -3868,7 +3877,7 @@ RRDGraph.prototype = { // this.gdes[i].end_orig = this.end; } - var areazero = 0.0 + var areazero = 0.0; var lastgdes = null; if (this.data_fetch() === -1) @@ -3980,7 +3989,7 @@ RRDGraph.prototype = { y = last_y; x = Math.round(x)+0.5; y = Math.round(y)+0.5; - this.ctx.lineTo(x, y) + this.ctx.lineTo(x, y); } else { var x = ii - 1 + this.xorigin; var y = this.ytr(this.gdes[i].p_data[ii - 1]); @@ -4169,7 +4178,7 @@ RRDGraph.prototype = { if (opts[0] === "end") end = opts[1]; } } - this.create_def(vname, rrdfile, name, cf, step, start, end, reduce) + this.create_def(vname, rrdfile, name, cf, step, start, end, reduce); }, create_def: function (vname, rrdfile, name, cf, step, start, end, reduce) { @@ -4178,7 +4187,7 @@ RRDGraph.prototype = { var end_t = new RRDTime(this.end); gdp.gf = RRDGraphDesc.GF.DEF; - gdp.vname = vname + gdp.vname = vname; gdp.vidx = this.find_var(vname); gdp.rrd = rrdfile; gdp.ds_nam = name; @@ -4214,7 +4223,7 @@ RRDGraph.prototype = { { var gdp = new RRDGraphDesc(this); gdp.gf = RRDGraphDesc.GF.CDEF; - gdp.vname = vname + gdp.vname = vname; gdp.vidx = this.find_var(vname); gdp.rpnp = new RRDRpn(rpn,this.gdes); @@ -4232,7 +4241,7 @@ RRDGraph.prototype = { { var gdp = new RRDGraphDesc(this); gdp.gf = RRDGraphDesc.GF.VDEF; - gdp.vname = vname + gdp.vname = vname; var index = rpn.indexOf(','); var name = rpn.substring(0,index); @@ -4256,7 +4265,7 @@ RRDGraph.prototype = { { var gdp = new RRDGraphDesc(this); gdp.gf = RRDGraphDesc.GF.SHIFT; - gdp.vname = vname // Â? + gdp.vname = vname; // Â? gdp.vidx = this.find_var(vname); // FIXME checks if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF) @@ -4814,7 +4823,7 @@ RRDGraph.prototype = { if (this.cf_conv(rra.getCFName()) === cf_idx) { cal_end = (rrd.getLastUpdate() - (rrd.getLastUpdate() % (rra.getPdpPerRow() * rra.pdp_step))); cal_start = (cal_end - (rra.getPdpPerRow() * rra.row_cnt * rra.pdp_step)); - full_match = gdp.end - gdp.start + full_match = gdp.end - gdp.start; tmp_step_diff = Math.abs(ft_step - (rrd.getMinStep() * rra.pdp_cnt)); if (cal_start <= gdp.start) { @@ -4872,4 +4881,4 @@ RRDGraph.prototype = { } return ft_step; } -} +}; |