title: D3 - Select by id
body: <p>data.json has an id field for each entry. This id maps directly to an id in test.csv. I'm creating circles for every object in data.json. I'd like to then read test.csv and alter the attributes of only the circles with ids that appear in test.csv. I think I'm probably missing something fundamental here...</p>
  
  <p>My most recent attempt to do this is a nested select. I first select all circles, then select only the circles with the ids in question.  Here's the code to create the circles, then edit them.</p>
  
  <pre><code>        d3.json("data.json", function(error, data){
              svg.selectAll("circle")
                  .data(data)
                  .enter()
                  .append("circle")
                  .attr("stroke", "black")
                  .attr("fill", "white")
                  .attr("r", 4)
                  .attr("cx", function(d){ return d.x; })
                  .attr("cy", function(d){ return d.y; })
                  .attr("id", function(d){return "i:" + d.id;})
                  .append("svg:title")
                  .text(function(d){ return d.id; });
          });
  
          d3.csv("test.csv", function(csv){
              csv.sort(function(a,b){
                  return new Date(b.timestamp+"Z") &lt; new Date(a.timestamp+"Z") ? 1 : -1;
              });
  
              svg.selectAll("circle")
                  .data(csv)
                  .selectAll( function(d) { return "#i:" + d.roomId; } )
                  .data(function(d) { return d; } )
                  .transition()
                  .duration(500)
                  .attr("fill", "red");
          });
  </code></pre>
  
  <p>To sum up the results, nothing happens.  The initial circles are created, but the transitions never occur.  Some print statements suggest that I'm successfully nabbing the circles with the ids from test.csv, but I'm not even sure of that...  Any suggestions on how to improve this code?  Even if this model can be fixed, I have a feeling there's a much cleaner solution anyway.</p>
  
  <p>Thanks!</p>