Aras Pranckevičius avatar Aras Pranckevičius committed 1f3ae36

graph: remove unused stuff, simplify

Comments (0)

Files changed (1)

rhodecode/public/js/graph.js

 	this.ctx.strokeStyle = 'rgb(0, 0, 0)';
 	this.ctx.fillStyle = 'rgb(0, 0, 0)';
 	this.cur = [0, 0];
-	this.max_column = 1;
 	this.line_width = 2.5;
 	this.dot_radius = 5.5;
 	
-	this.scale = function(height) {
-		this.box_size = Math.floor(height/1.2);
-	}
-	
 	this.setColor = function(color, bg, fg) {
 		color %= colors.length;
 		var red = (colors[color][0] * fg) || bg;
 		var rela = document.getElementById('graph');
 		var pad = width;
 		var scale = 22;
+		var box_size = Math.floor(scale/1.2);
 
 		for (var i in data) {
-			this.scale(scale);
 
 			var row = document.getElementById("chg_"+idx);
 			if (row == null)
 				end = line[1];
 				color = line[2];
 
-				if (start > this.max_column) {
-					this.max_column = start;
-				}
-				
-				if (end > this.max_column) {
-					this.max_column = end;
-				}
-				
 				this.setColor(color, 0.0, 0.65);
 
 				
-				x = pad-(this.box_size * start - 1 + scale);
+				x = pad-(box_size * start - 1 + scale);
 				
 				this.ctx.lineWidth=this.line_width;
 				this.ctx.beginPath();
 				
 				if (start == end)
 				{
-					x = pad-((1 + this.box_size * end) + scale-2);
+					x = pad-((1 + box_size * end) + scale-2);
 					this.ctx.lineTo(x,nextY+extra,3);
 				}
 				else
 				{
-					var x2 = pad-((1 + this.box_size * end) + scale-2);
+					var x2 = pad-((1 + box_size * end) + scale-2);
 					var ymid = (rowY+nextY) / 2;
 					this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
 				}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.