Changeset - cc5dc31859d4
[Not reviewed]
beta
0 1 0
Aras Pranckevicius - 14 years ago 2012-01-09 08:16:43
aras@unity3d.com
graph: make it handle different row heights while still doing dots in the middle of each row
1 file changed with 10 insertions and 11 deletions:
0 comments (0 inline, 0 general)
rhodecode/public/js/graph.js
Show inline comments
 
@@ -67,7 +67,7 @@ function BranchRenderer() {
 
		for (var i in data) {
 
			this.scale(scale);
 
			var row = document.getElementById("chg_"+idx);
 
			var	next = document.getElementById("chg_"+idx+1);
 
			var	next = document.getElementById("chg_"+(idx+1));
 
			var extra = 0;
 
			
 
			//skip this since i don't have DATE in my app
 
@@ -82,7 +82,10 @@ function BranchRenderer() {
 
			nodeid = cur[0];
 
			node = cur[1];
 
			in_l = cur[2];
 
			
 

	
 
			var rowY = row.offsetTop + row.offsetHeight/2 - rela.offsetTop;
 
			var nextY = (next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + next.offsetHeight/2 - rela.offsetTop;
 

	
 
			for (var j in in_l) {
 
				
 
				line = in_l[j];
 
@@ -100,26 +103,23 @@ function BranchRenderer() {
 
				
 
				this.setColor(color, 0.0, 0.65);
 
				
 
				y = row.offsetTop-rela.offsetTop+row.offsetHeight/2;
 
				x = pad-((this.cell[0] + this.box_size * start - 1) + this.bg_height-2);
 
				
 
				this.ctx.lineWidth=this.line_width;
 
				this.ctx.beginPath();
 
				this.ctx.moveTo(x, y);
 
				this.ctx.moveTo(x, rowY);
 

	
 
				
 
				if (start == end)
 
				{
 
					x = pad-((1 + this.box_size * end) + this.bg_height-2);
 
					y += row.offsetHeight;
 
					this.ctx.lineTo(x,y+extra,3);
 
					this.ctx.lineTo(x,nextY+extra,3);
 
				}
 
				else
 
				{
 
					var x2 = pad-((1 + this.box_size * end) + this.bg_height-2);
 
					var y2 = y + row.offsetHeight;
 
					var ymid = (y+y2) / 2;
 
					this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,y2);
 
					var ymid = (rowY+nextY) / 2;
 
					this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
 
				}
 
				this.ctx.stroke();
 
			}
 
@@ -128,12 +128,11 @@ function BranchRenderer() {
 
			color = node[1]
 
			
 
			radius = this.dot_radius;
 
			y = row.offsetTop-rela.offsetTop+row.offsetHeight/2;
 
			x = pad-(Math.round(this.cell[0] * scale/2 * column + radius) + 15 - (column*4));
 
		
 
			this.ctx.beginPath();
 
			this.setColor(color, 0.25, 0.75);
 
			this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
 
			this.ctx.arc(x, rowY, radius, 0, Math.PI * 2, true);
 
			this.ctx.fill();
 
			
 
			idx++;
0 comments (0 inline, 0 general)