diff rhodecode/templates/changelog/changelog.html @ 1429:864e4daef963 beta

improved rendering of dag (they are not trimmed anymore when number of heads exceeds 5)
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 16 Jul 2011 12:33:40 +0200
parents 5a96551ee9c0
children d5d7c40e8591
line wrap: on
line diff
--- a/rhodecode/templates/changelog/changelog.html	Sat Jul 16 12:02:14 2011 +0200
+++ b/rhodecode/templates/changelog/changelog.html	Sat Jul 16 12:33:40 2011 +0200
@@ -139,21 +139,31 @@
                         }
                     });					
 					
-					function set_canvas() {
+					function set_canvas(heads) {
 						var c = document.getElementById('graph_nodes');
 						var t = document.getElementById('graph_content');
 						canvas = document.getElementById('graph_canvas');
 						var div_h = t.clientHeight;
 						c.style.height=div_h+'px';
 						canvas.setAttribute('height',div_h);
-						canvas.setAttribute('width',160);
+						c.style.height=max_w+'px';
+						canvas.setAttribute('width',max_w);
 					};
-					set_canvas();
+					var heads = 1;
+					var max_heads = 0;
 					var jsdata = ${c.jsdata|n};
+					
+					for( var i=0;i<jsdata.length;i++){
+					    var m = Math.max.apply(Math, jsdata[i][1]);
+					    if (m>max_heads){
+					        max_heads = m;
+					    }
+					}
+					var max_w = Math.max(100,max_heads*25);
+					set_canvas(max_w);
+					
 					var r = new BranchRenderer();
-					r.render(jsdata);
-					
-
+					r.render(jsdata,max_w);
 					
 				});
 			</script>