title: d3 sorting of an array of objects
body: <p>How do I update a vertical bar chart in d3 after having sorted the array of objects holding my data?</p>
  
  <p>My (surely petty) problem is best seen here : <a href="http://jsfiddle.net/yJq3e/3/" rel="nofollow">http://jsfiddle.net/yJq3e/3/</a></p>
  
  <p>After the bars creation, I call the <code>sortBars()</code> function, which works fine (as <code>console.log</code> can tell me) until I update the y-attribute. I assume it's connected to the y-attribute being actually dependent on the index (or the key?). However, I would've thought calling </p>
  
  <pre><code>.attr("y", function(d) { return y(d.name); })
  </code></pre>
  
  <p>on the <code>.bar</code>-attribute again after sorting should suffice as it does when I set the attribute for the initial position of the bars.</p>
  
  <p>any help much appreciated !</p>