##// END OF EJS Templates
graph: make it handle different row heights while still doing dots in the middle of each row
Aras Pranckevicius -
r1873:cc5dc318 beta
parent child Browse files
Show More
@@ -67,7 +67,7 b' function BranchRenderer() {'
67 for (var i in data) {
67 for (var i in data) {
68 this.scale(scale);
68 this.scale(scale);
69 var row = document.getElementById("chg_"+idx);
69 var row = document.getElementById("chg_"+idx);
70 var next = document.getElementById("chg_"+idx+1);
70 var next = document.getElementById("chg_"+(idx+1));
71 var extra = 0;
71 var extra = 0;
72
72
73 //skip this since i don't have DATE in my app
73 //skip this since i don't have DATE in my app
@@ -82,7 +82,10 b' function BranchRenderer() {'
82 nodeid = cur[0];
82 nodeid = cur[0];
83 node = cur[1];
83 node = cur[1];
84 in_l = cur[2];
84 in_l = cur[2];
85
85
86 var rowY = row.offsetTop + row.offsetHeight/2 - rela.offsetTop;
87 var nextY = (next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + next.offsetHeight/2 - rela.offsetTop;
88
86 for (var j in in_l) {
89 for (var j in in_l) {
87
90
88 line = in_l[j];
91 line = in_l[j];
@@ -100,26 +103,23 b' function BranchRenderer() {'
100
103
101 this.setColor(color, 0.0, 0.65);
104 this.setColor(color, 0.0, 0.65);
102
105
103 y = row.offsetTop-rela.offsetTop+row.offsetHeight/2;
104 x = pad-((this.cell[0] + this.box_size * start - 1) + this.bg_height-2);
106 x = pad-((this.cell[0] + this.box_size * start - 1) + this.bg_height-2);
105
107
106 this.ctx.lineWidth=this.line_width;
108 this.ctx.lineWidth=this.line_width;
107 this.ctx.beginPath();
109 this.ctx.beginPath();
108 this.ctx.moveTo(x, y);
110 this.ctx.moveTo(x, rowY);
109
111
110
112
111 if (start == end)
113 if (start == end)
112 {
114 {
113 x = pad-((1 + this.box_size * end) + this.bg_height-2);
115 x = pad-((1 + this.box_size * end) + this.bg_height-2);
114 y += row.offsetHeight;
116 this.ctx.lineTo(x,nextY+extra,3);
115 this.ctx.lineTo(x,y+extra,3);
116 }
117 }
117 else
118 else
118 {
119 {
119 var x2 = pad-((1 + this.box_size * end) + this.bg_height-2);
120 var x2 = pad-((1 + this.box_size * end) + this.bg_height-2);
120 var y2 = y + row.offsetHeight;
121 var ymid = (rowY+nextY) / 2;
121 var ymid = (y+y2) / 2;
122 this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
122 this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,y2);
123 }
123 }
124 this.ctx.stroke();
124 this.ctx.stroke();
125 }
125 }
@@ -128,12 +128,11 b' function BranchRenderer() {'
128 color = node[1]
128 color = node[1]
129
129
130 radius = this.dot_radius;
130 radius = this.dot_radius;
131 y = row.offsetTop-rela.offsetTop+row.offsetHeight/2;
132 x = pad-(Math.round(this.cell[0] * scale/2 * column + radius) + 15 - (column*4));
131 x = pad-(Math.round(this.cell[0] * scale/2 * column + radius) + 15 - (column*4));
133
132
134 this.ctx.beginPath();
133 this.ctx.beginPath();
135 this.setColor(color, 0.25, 0.75);
134 this.setColor(color, 0.25, 0.75);
136 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
135 this.ctx.arc(x, rowY, radius, 0, Math.PI * 2, true);
137 this.ctx.fill();
136 this.ctx.fill();
138
137
139 idx++;
138 idx++;
General Comments 0
You need to be logged in to leave comments. Login now