File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,7 @@ const status_to_color = {
30
30
"headers-only" : "yellow" ,
31
31
}
32
32
33
- function draw ( ) {
34
- data = state_data
33
+ function preprocess_data ( data ) {
35
34
let header_infos = data . header_infos ;
36
35
let tip_infos = [ ] ;
37
36
let node_infos = data . nodes ;
@@ -92,7 +91,15 @@ function draw() {
92
91
93
92
// assigns the data to a hierarchy using parent-child relationships
94
93
// and maps the node data to the tree layout
95
- var root_node = treemap ( d3 . hierarchy ( treeData ) ) ;
94
+ const root_node = treemap ( d3 . hierarchy ( treeData ) ) ;
95
+ const max_height = Math . max ( ...header_infos . map ( d => d . height ) )
96
+
97
+ return [ root_node , max_height , htoi ]
98
+ }
99
+
100
+ function draw ( ) {
101
+ let data = state_data
102
+ const [ root_node , max_height , htoi ] = preprocess_data ( data )
96
103
97
104
var svg = d3
98
105
. select ( "#drawing-area" )
@@ -308,7 +315,6 @@ function draw() {
308
315
309
316
let offset_x = 0 ;
310
317
let offset_y = 0 ;
311
- let max_height = Math . max ( ...header_infos . map ( d => d . height ) )
312
318
let max_height_tip = root_node . leaves ( ) . filter ( d => d . data . data . height == max_height ) [ 0 ]
313
319
if ( max_height_tip !== undefined ) {
314
320
offset_x = o . x ( max_height_tip , htoi ) ;
You can’t perform that action at this time.
0 commit comments