title: Moving fixed nodes in D3
body: <p>I have nodes in a D3 force-directed layout that are set to .<em>fixed</em> = true. If I set the .x or .y values, the nodes themselves don't move to their new position.</p>
  
  <p>Here's my function:</p>
  
  <pre><code>function fixNode(idArray, locationX, locationY) {
      for ( x = 0; x &lt; idArray.length; x++ ) {
          for ( y = 0; y &lt; nodes.length; y++ ) {
              if (nodes[y].id == idArray[x]) {
                  nodes[y].fixed = true;
                  nodes[y].x = 50;
                  nodes[y].y = 50;
                  break;
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>UPDATE 1:</strong> </p>
  
  <p>Here is the working function based on Jason's advice:</p>
  
  <pre><code>function fixNode(idArray, locationX, locationY) {
      for ( x = 0; x &lt; idArray.length; x++ ) {
          for ( y = 0; y &lt; nodes.length; y++ ) {
              if (nodes[y].id == idArray[x]) {
                  nodes[y].fixed = true;
                  nodes[y].x = 50;
                  nodes[y].y = 50;
                  nodes[y].px = 50;
                  nodes[y].py = 50;
                  break;
              }
          }
      }
      tick();
  }
  </code></pre>