title: D3: Select SVG attribute and change it
body: <p>if I have an SVG...</p>
  
  <pre><code>var canvasBars = d3.select("#chart1").append("svg")
  .attr("width", width + margin.left + margin.right)
  .attr("height", height + margin.top + margin.bottom)    
  .append("g")
  .attr("transform", "translate("+margin.left+","+margin.top+")");
  </code></pre>
  
  <p>If I modify the width variable (used to calculate the width attribute)  How do I then select the width attribute and modify it with this new width variable?</p>
  
  <p>this does not seem to work:</p>
  
  <pre><code>canvasBars.attr("width", width + margin.left + margin.right);
  </code></pre>