File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -203,10 +203,11 @@ export default class Tree extends React.Component {
203
203
* @return {object } Object containing `nodes` and `links` fields.
204
204
*/
205
205
generateTree ( ) {
206
- const { initialDepth, depthFactor } = this . props ;
206
+ const { initialDepth, depthFactor, separation } = this . props ;
207
+ console . log ( separation ) ;
207
208
const tree = layout . tree ( )
208
209
. nodeSize ( [ 100 + 40 , 100 + 40 ] )
209
- . separation ( ( d ) => d . _children ? 1.2 : 0.9 )
210
+ . separation ( ( d ) => d . _children ? separation . node : separation . leafNode )
210
211
. children ( ( d ) => d . _collapsed ? null : d . _children ) ;
211
212
212
213
const rootNode = this . state . data [ 0 ] ;
@@ -285,6 +286,7 @@ Tree.defaultProps = {
285
286
initialDepth : undefined ,
286
287
zoomable : true ,
287
288
scaleExtent : { min : 0.1 , max : 1 } ,
289
+ separation : { node : 1.2 , leafNode : 0.9 } ,
288
290
styles : {
289
291
nodes : {
290
292
node : {
@@ -325,6 +327,10 @@ Tree.propTypes = {
325
327
min : PropTypes . number ,
326
328
max : PropTypes . number ,
327
329
} ) ,
330
+ separation : PropTypes . shape ( {
331
+ node : PropTypes . number ,
332
+ leafNode : PropTypes . number ,
333
+ } ) ,
328
334
styles : PropTypes . shape ( {
329
335
nodes : PropTypes . object ,
330
336
links : PropTypes . object ,
You can’t perform that action at this time.
0 commit comments