Show More
@@ -1736,15 +1736,14 b' overflow:hidden;' | |||||
1736 | } |
|
1736 | } | |
1737 |
|
1737 | |||
1738 | #graph_nodes { |
|
1738 | #graph_nodes { | |
1739 | width:160px; |
|
|||
1740 | float:left; |
|
1739 | float:left; | |
1741 | margin-left:-50px; |
|
|||
1742 | margin-top:5px; |
|
1740 | margin-top:5px; | |
1743 | } |
|
1741 | } | |
1744 |
|
1742 | |||
1745 | #graph_content { |
|
1743 | #graph_content { | |
1746 | width:800px; |
|
1744 | width:800px; | |
1747 | float:left; |
|
1745 | float:left; | |
|
1746 | ||||
1748 | } |
|
1747 | } | |
1749 |
|
1748 | |||
1750 | #graph_content .container_header { |
|
1749 | #graph_content .container_header { |
@@ -58,10 +58,10 b' function BranchRenderer() {' | |||||
58 | this.ctx.fillStyle = s; |
|
58 | this.ctx.fillStyle = s; | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | this.render = function(data) { |
|
61 | this.render = function(data,pad) { | |
62 | var idx = 1; |
|
62 | var idx = 1; | |
63 | var rela = document.getElementById('graph'); |
|
63 | var rela = document.getElementById('graph'); | |
64 |
var pad = |
|
64 | var pad = pad; | |
65 | var scale = 22; |
|
65 | var scale = 22; | |
66 |
|
66 | |||
67 | for (var i in data) { |
|
67 | for (var i in data) { |
@@ -139,21 +139,31 b'' | |||||
139 | } |
|
139 | } | |
140 | }); |
|
140 | }); | |
141 |
|
141 | |||
142 | function set_canvas() { |
|
142 | function set_canvas(heads) { | |
143 | var c = document.getElementById('graph_nodes'); |
|
143 | var c = document.getElementById('graph_nodes'); | |
144 | var t = document.getElementById('graph_content'); |
|
144 | var t = document.getElementById('graph_content'); | |
145 | canvas = document.getElementById('graph_canvas'); |
|
145 | canvas = document.getElementById('graph_canvas'); | |
146 | var div_h = t.clientHeight; |
|
146 | var div_h = t.clientHeight; | |
147 | c.style.height=div_h+'px'; |
|
147 | c.style.height=div_h+'px'; | |
148 | canvas.setAttribute('height',div_h); |
|
148 | canvas.setAttribute('height',div_h); | |
149 | canvas.setAttribute('width',160); |
|
149 | c.style.height=max_w+'px'; | |
|
150 | canvas.setAttribute('width',max_w); | |||
150 | }; |
|
151 | }; | |
151 | set_canvas(); |
|
152 | var heads = 1; | |
|
153 | var max_heads = 0; | |||
152 | var jsdata = ${c.jsdata|n}; |
|
154 | var jsdata = ${c.jsdata|n}; | |
|
155 | ||||
|
156 | for( var i=0;i<jsdata.length;i++){ | |||
|
157 | var m = Math.max.apply(Math, jsdata[i][1]); | |||
|
158 | if (m>max_heads){ | |||
|
159 | max_heads = m; | |||
|
160 | } | |||
|
161 | } | |||
|
162 | var max_w = Math.max(100,max_heads*25); | |||
|
163 | set_canvas(max_w); | |||
|
164 | ||||
153 | var r = new BranchRenderer(); |
|
165 | var r = new BranchRenderer(); | |
154 | r.render(jsdata); |
|
166 | r.render(jsdata,max_w); | |
155 |
|
||||
156 |
|
||||
157 |
|
167 | |||
158 | }); |
|
168 | }); | |
159 | </script> |
|
169 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now