dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.83k stars 588 forks source link

Set individual nodesep #387

Open haexhub opened 4 years ago

haexhub commented 4 years ago

Hi, I would like to change the nodeseparation per node and not globally like this:

var g = new dagreD3.graphlib.Graph()
.setGraph({ rankdir: 'LR', edgesep: 10, ranksep: 60, nodesep: 10 })

I'm looking for something like this:

var g = new dagreD3.graphlib.Graph().setGraph({ )
g.nodes().forEach(label => {

    if (label == 'the answer') {
      let node = g.node(label)
      node.nodesep = 42
    }
  })

How can I do that? :)