diff options
Diffstat (limited to 'js/RrdGfxCanvas.js')
-rw-r--r-- | js/RrdGfxCanvas.js | 13 |
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 | ||
68 | RrdGfxCanvas.prototype.dashed_line = function (X0, Y0, X1, Y1, width, color, dash_on, dash_off) | 68 | RrdGfxCanvas.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 | ||
207 | RrdGfxCanvas.prototype.text = function (x, y, color, font, tabwidth, angle, h_align, v_align, text) | 208 | RrdGfxCanvas.prototype.text = function (x, y, color, font, tabwidth, angle, h_align, v_align, text) |