How do I update a vertical bar chart in d3 after having sorted the array of objects holding my data?
My (surely petty) problem is best seen here : http://jsfiddle.net/yJq3e/3/
After the bars creation, I call the sortBars() function, which works fine (as console.log 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
.attr("y", function(d) { return y(d.name); })
on the .bar-attribute again after sorting should suffice as it does when I set the attribute for the initial position of the bars.
any help much appreciated !