File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ class TreeBuilder {
16
16
var allNodes = this . allNodes ;
17
17
var nodeSize = this . nodeSize ;
18
18
19
+ var width = opts . width + opts . margin . left + opts . margin . right ;
20
+ var height = opts . height + opts . margin . top + opts . margin . bottom ;
21
+
19
22
var zoom = d3 . behavior . zoom ( )
20
23
. scaleExtent ( [ 0.1 , 10 ] )
21
24
. on ( 'zoom' , _ . bind ( function ( ) {
@@ -26,11 +29,11 @@ class TreeBuilder {
26
29
//make an SVG
27
30
var svg = this . svg = d3 . select ( opts . target )
28
31
. append ( 'svg' )
29
- . attr ( 'width' , opts . width + opts . margin . left + opts . margin . right )
30
- . attr ( 'height' , opts . height + opts . margin . top + opts . margin . bottom )
32
+ . attr ( 'width' , width )
33
+ . attr ( 'height' , height )
31
34
. call ( zoom )
32
35
. append ( 'g' )
33
- . attr ( 'transform' , 'translate(' + opts . margin . left + ',' + opts . margin . top + ')' ) ;
36
+ . attr ( 'transform' , 'translate(' + width / 2 + ',' + opts . margin . top + ')' ) ;
34
37
35
38
// Compute the layout.
36
39
this . tree = d3 . layout . tree ( )
You can’t perform that action at this time.
0 commit comments