File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -36,21 +36,29 @@ class Chart extends Component {
36
36
37
37
maked3Tree ( ) {
38
38
this . removed3Tree ( ) ;
39
- let width = 960 ;
40
- let height = 1060 ;
39
+ let width = 600 ;
40
+
41
+ const margin = {
42
+ top : 20 ,
43
+ right : 120 ,
44
+ bottom : 20 ,
45
+ left : 120 ,
46
+ } ;
47
+ // const width = 600 - margin.right - margin.left;
48
+ const height = 600 - margin . top - margin . bottom ;
49
+
41
50
let chartContainer = d3 . select ( this . chartRef . current )
42
51
. append ( 'svg' ) // chartContainer is now pointing to svg
43
52
. attr ( 'width' , width )
44
53
. attr ( 'height' , height ) ;
45
54
46
- svg . call ( d3 . zoom ( )
55
+ chartContainer . call ( d3 . zoom ( )
47
56
. on ( "zoom" , function ( ) {
48
- svg . attr ( "transform" , d3 . event . transform )
57
+ chartContainer . attr ( "transform" , d3 . event . transform )
49
58
} ) )
50
59
. append ( "g" )
51
60
52
- let g = chartContainer
53
- . append ( "g" )
61
+ let g = chartContainer . append ( "g" )
54
62
// this is changing where the graph is located physically
55
63
. attr ( "transform" , `translate(${ width / 2 + 4 } , ${ height / 2 + 2 } )` ) ;
56
64
You can’t perform that action at this time.
0 commit comments