aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js
diff options
context:
space:
mode:
authorManuel Luis SanmartĂ­n Rozada2015-04-03 23:06:54 +0200
committerPim van den Berg2015-06-22 11:03:23 +0200
commit05d3a016507c294fa90a7176f1b6e604d25d1647 (patch)
treefffb3b3fe44a0bfe1b7de70e668b61ba4fdc50a5 /js
parentjsrrdgraph: Fix tabs. (diff)
downloadapt-panopticon_cgp-05d3a016507c294fa90a7176f1b6e604d25d1647.zip
apt-panopticon_cgp-05d3a016507c294fa90a7176f1b6e604d25d1647.tar.gz
apt-panopticon_cgp-05d3a016507c294fa90a7176f1b6e604d25d1647.tar.bz2
apt-panopticon_cgp-05d3a016507c294fa90a7176f1b6e604d25d1647.tar.xz
jsrrdgraph: Use dash lines in canvas for the grid.
Diffstat (limited to 'js')
-rw-r--r--js/RrdGfxCanvas.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/js/RrdGfxCanvas.js b/js/RrdGfxCanvas.js
index 78b8adf..110c032 100644
--- a/js/RrdGfxCanvas.js
+++ b/js/RrdGfxCanvas.js
@@ -95,8 +95,21 @@ RrdGfxCanvas.prototype.dashed_line = function (X0, Y0, X1, Y1, width, color, das
95 this.ctx.save(); 95 this.ctx.save();
96 this.ctx.lineWidth = width; 96 this.ctx.lineWidth = width;
97 this.ctx.strokeStyle = color; 97 this.ctx.strokeStyle = color;
98 98 this.ctx.setLineDash([ dash_on, dash_off ]);
99 this.ctx.lineDashOffset = dash_on;
99 this.ctx.beginPath(); 100 this.ctx.beginPath();
101
102 if (Y0 === Y1) {
103 Y0 += 0.5;
104 Y1 += 0.5;
105 } else if (X0 === X1) {
106 X0 += 0.5;
107 X1 += 0.5;
108 }
109
110 this.ctx.moveTo(X0, Y0);
111 this.ctx.lineTo(X1, Y1);
112/*
100 if (Y0 === Y1) { 113 if (Y0 === Y1) {
101 Y0 += 0.5; 114 Y0 += 0.5;
102 Y1 += 0.5; 115 Y1 += 0.5;
@@ -142,6 +155,7 @@ RrdGfxCanvas.prototype.dashed_line = function (X0, Y0, X1, Y1, width, color, das
142 this.ctx.moveTo(X0, Y0); 155 this.ctx.moveTo(X0, Y0);
143 this.ctx.lineTo(X1, Y1); 156 this.ctx.lineTo(X1, Y1);
144 } 157 }
158*/
145 this.ctx.stroke(); 159 this.ctx.stroke();
146 this.ctx.restore(); 160 this.ctx.restore();
147}; 161};