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