aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js/RrdGfxCanvas.js
diff options
context:
space:
mode:
authorPeter Wu2014-07-25 23:28:21 +0200
committerPim van den Berg2014-08-02 12:29:32 +0200
commitb6be82b8edefa452e72ed53391971e53d9dccf83 (patch)
tree01a33ac72f6ef7e6e5c607238bc5e4dd3a8751fe /js/RrdGfxCanvas.js
parentsupport php versions without json support and show a warning message (diff)
downloadapt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.zip
apt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.tar.gz
apt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.tar.bz2
apt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.tar.xz
jsrrdgraph: Fixed jshint warnings/errors
Many fall in the category missing semicolon, but there are legitimate bugs (like throwing an error with an undefined variable, using isInfinite instead of !isFinite or fabs instead of Math.abs). At some places, I moved the variable declarations to avoid duplicate definition warnings. Redundant breaks have been removed (after return / throw). Global variables were implicitly defined in RrdDataFile (which caught my attention) and Base64, these have been made local. Also fixed some whitespace errors. Yay, the consistency. Not all (style) issues are fixed.
Diffstat (limited to 'js/RrdGfxCanvas.js')
-rw-r--r--js/RrdGfxCanvas.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/js/RrdGfxCanvas.js b/js/RrdGfxCanvas.js
index 070b806..0d1784e 100644
--- a/js/RrdGfxCanvas.js
+++ b/js/RrdGfxCanvas.js
@@ -57,7 +57,7 @@ RrdGfxCanvas.prototype.line = function (X0, Y0, X1, Y1, width, color)
57 } 57 }
58 this.ctx.save(); 58 this.ctx.save();
59 this.ctx.lineWidth = width; 59 this.ctx.lineWidth = width;
60 this.ctx.strokeStyle = color 60 this.ctx.strokeStyle = color;
61 this.ctx.beginPath(); 61 this.ctx.beginPath();
62 this.ctx.moveTo(X0, Y0); 62 this.ctx.moveTo(X0, Y0);
63 this.ctx.lineTo(X1, Y1); 63 this.ctx.lineTo(X1, Y1);
@@ -67,6 +67,7 @@ RrdGfxCanvas.prototype.line = function (X0, Y0, X1, Y1, width, color)
67 67
68RrdGfxCanvas.prototype.dashed_line = function (X0, Y0, X1, Y1, width, color, dash_on, dash_off) 68RrdGfxCanvas.prototype.dashed_line = function (X0, Y0, X1, Y1, width, color, dash_on, dash_off)
69{ 69{
70 var swap, n;
70 X0 = Math.round(X0); 71 X0 = Math.round(X0);
71 Y0 = Math.round(Y0); 72 Y0 = Math.round(Y0);
72 X1 = Math.round(X1); 73 X1 = Math.round(X1);
@@ -81,12 +82,12 @@ RrdGfxCanvas.prototype.dashed_line = function (X0, Y0, X1, Y1, width, color, das
81 Y0 += 0.5; 82 Y0 += 0.5;
82 Y1 += 0.5; 83 Y1 += 0.5;
83 if (X0 > X1) { 84 if (X0 > X1) {
84 var swap = X0; 85 swap = X0;
85 X0 = X1; 86 X0 = X1;
86 X1 = swap; 87 X1 = swap;
87 } 88 }
88 this.ctx.moveTo(X0, Y0); 89 this.ctx.moveTo(X0, Y0);
89 var n=0; 90 n = 0;
90 while(X0<=X1) { 91 while(X0<=X1) {
91 if (n%2 === 1) { 92 if (n%2 === 1) {
92 X0 += dash_on; 93 X0 += dash_on;
@@ -101,12 +102,12 @@ RrdGfxCanvas.prototype.dashed_line = function (X0, Y0, X1, Y1, width, color, das
101 X0 += 0.5; 102 X0 += 0.5;
102 X1 += 0.5; 103 X1 += 0.5;
103 if (Y0 > Y1) { 104 if (Y0 > Y1) {
104 var swap = Y0; 105 swap = Y0;
105 Y0 = Y1; 106 Y0 = Y1;
106 Y1 = swap; 107 Y1 = swap;
107 } 108 }
108 this.ctx.moveTo(X0, Y0); 109 this.ctx.moveTo(X0, Y0);
109 var n=0; 110 n = 0;
110 while(Y0<=Y1) { 111 while(Y0<=Y1) {
111 if (n%2 === 1) { 112 if (n%2 === 1) {
112 Y0 += dash_on; 113 Y0 += dash_on;
@@ -201,7 +202,7 @@ RrdGfxCanvas.prototype.lineTo = function (x,y)
201{ 202{
202 x = Math.round(x)+0.5; 203 x = Math.round(x)+0.5;
203 y = Math.round(y)+0.5; 204 y = Math.round(y)+0.5;
204 this.ctx.lineTo(x, y) 205 this.ctx.lineTo(x, y);
205}; 206};
206 207
207RrdGfxCanvas.prototype.text = function (x, y, color, font, tabwidth, angle, h_align, v_align, text) 208RrdGfxCanvas.prototype.text = function (x, y, color, font, tabwidth, angle, h_align, v_align, text)