title: D3 Get Variable Value
body: <p>This is a very basic question, but how do I access the value of attributes in d3?
  I just started learning today, so I haven't figured this out yet</p>
  
  <p>Suppose I have this as part of my code here
  <a href="http://jsfiddle.net/matthewpiatetsky/nCNyE/9/" rel="nofollow">http://jsfiddle.net/matthewpiatetsky/nCNyE/9/</a></p>
  
  <pre><code>   var node = svg.selectAll("circle.node")
         .data(nodes)
         .enter().append("circle")
         .attr("class", "node")
         .attr("r", function (d) {
          if (width &lt; height){
          return d.count * width/100;
          } else {
          return d.count * height/100;
          }
  })
       .on("mouseover", animateFirstStep)
       .on("mouseout",animateSecondStep)
         .style("fill", function(d,i){return color(i);})
         .call(force.drag);
  </code></pre>
  
  <p>For my animation the circle gets bigger when you mouse over it, and I want the circle to return to its normal size when you move the mouse away. However, i'm not sure how to get the value of the radius. </p>
  
  <p>i set the value here</p>
  
  <pre><code>.attr("r", function (d) {
          if (width &lt; height){
          return d.count * width/100;
          } else {
          return d.count * height/100;
          }
  </code></pre>
  
  <p>I tried to do node.r and things like that, but i'm not sure what the correct syntax is
  Thanks!</p>