Show More
@@ -165,12 +165,11 | |||||
165 | msg.style.cursor = 's-resize'; |
|
165 | msg.style.cursor = 's-resize'; | |
166 | msg.onclick = function() { |
|
166 | msg.onclick = function() { | |
167 | this.parentNode.parentNode.style.height = 'auto'; |
|
167 | this.parentNode.parentNode.style.height = 'auto'; | |
168 | repaint_graph(); |
|
|||
169 | } |
|
168 | } | |
170 | } |
|
169 | } | |
171 | } |
|
170 | } | |
172 |
|
171 | |||
173 |
function set_canvas( |
|
172 | function set_canvas(heads) { | |
174 | var c = document.getElementById('graph_nodes'); |
|
173 | var c = document.getElementById('graph_nodes'); | |
175 | var t = document.getElementById('graph_content'); |
|
174 | var t = document.getElementById('graph_content'); | |
176 | canvas = document.getElementById('graph_canvas'); |
|
175 | canvas = document.getElementById('graph_canvas'); | |
@@ -180,25 +179,22 | |||||
180 | c.style.height=max_w+'px'; |
|
179 | c.style.height=max_w+'px'; | |
181 | canvas.setAttribute('width',max_w); |
|
180 | canvas.setAttribute('width',max_w); | |
182 | }; |
|
181 | }; | |
183 | function calc_max_w(jsdata) { |
|
182 | var heads = 1; | |
184 |
|
|
183 | var max_heads = 0; | |
185 | var max_heads = 0; |
|
184 | var jsdata = ${c.jsdata|n}; | |
186 | for( var i=0;i<jsdata.length;i++){ |
|
185 | ||
187 | var m = Math.max.apply(Math, jsdata[i][1]); |
|
186 | for( var i=0;i<jsdata.length;i++){ | |
188 | if (m>max_heads){ |
|
187 | var m = Math.max.apply(Math, jsdata[i][1]); | |
189 |
|
|
188 | if (m>max_heads){ | |
190 | } |
|
189 | max_heads = m; | |
191 |
|
|
190 | } | |
192 | return Math.max(100,max_heads*25); |
|
|||
193 | } |
|
191 | } | |
194 | function repaint_graph() { |
|
192 | var max_w = Math.max(100,max_heads*25); | |
195 | var jsdata = ${c.jsdata|n}; |
|
193 | set_canvas(max_w); | |
196 | var max_w = calc_max_w(jsdata); |
|
194 | ||
197 | set_canvas(max_w); |
|
195 | var r = new BranchRenderer(); | |
198 | var r = new BranchRenderer(); |
|
196 | r.render(jsdata,max_w); | |
199 | r.render(jsdata,max_w); |
|
197 | ||
200 | } |
|
|||
201 | repaint_graph (); |
|
|||
202 | }); |
|
198 | }); | |
203 | </script> |
|
199 | </script> | |
204 | %else: |
|
200 | %else: |
General Comments 0
You need to be logged in to leave comments.
Login now