title: How to assign the center of d3.forceRadial dynamically using functions?
body: <p>I have a data set which has parent and child nodes. Parent nodes can link with other parent nodes and child nodes can link with their parent nodes. What I want to do is to put child nodes radially placed around parent nodes. The nodes look something like this </p>
  
  <pre><code>parent: [{
      id: 1,
      type: 'parent',
      x: ,
      y: ,
      vx: ,
      vy: ,
  }, {
      id: 2
      x: ,
      y: ,
      vx: ,
      vy: ,
  }]
  
  child: [{
      id: 1,
      type: 'child',
      parent_node: {
          id: 1,
          x: ,
          y: ,
          vx: ,
          vy: ,
      },
      x: ,
      y: ,
      vx: ,
      vy: ,
  }]
  </code></pre>
  
  <p>So I have the details of the parent node such as its x and y inside the child nodes.</p>
  
  <p>I tried to assign <code>x</code> and <code>y</code> (as in the centre) dynamically but could not find a way to do it: </p>
  
  <pre><code>force('radial', d3.forceRadial()
      .radius(node =&gt; {
          if (node.type === 'child') {
              return 10
          }
          return 0
      })
      .x(node =&gt; {
          if (node.type === 'child') {
              return node.parent_node.x
          }
          return 0
      })
      .y(node =&gt; {
          if (node.type === 'child') {
              return node.parent_node.y
          }
          return 0
      })
  )
  </code></pre>
  
  <p>Can something like this be done? So that the centre for each child node can be provided dynamically, based on their parent's position?</p>