title: Rotate svg in place using d3.js
body: <p>I am trying to rotate a svg element with content using d3.js but it always gets out from the viewbox, what i want to achieve is rotate svg in place then later i can rotate the svg to <code>0,90,180,270deg</code> but for now my goal is to rotate it in place.</p>
  
  <p>My code is below ( i removed the irrelevant codes) </p>
  
  <pre><code> var svgContainer = d3.select("body").append("svg")                                          
                      .attr("width",121)                                   
                      .attr("height", 108)
                 //below is my code to rotate the svg
                  attr('transform', 'rotate(180 0 0)')
  </code></pre>
  
  <p>My original svg</p>
  
  <p><a href="https://i.stack.imgur.com/pk16N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pk16N.png" alt="enter image description here"></a></p>
  
  <p>My output when putting <code>attr('transform', 'rotate(180 0 0)')</code></p>
  
  <p><a href="https://i.stack.imgur.com/CIjX9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CIjX9.png" alt="enter image description here"></a></p>
  
  <p>What i want to achieve</p>
  
  <p><a href="https://i.stack.imgur.com/wAVLe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wAVLe.png" alt="enter image description here"></a></p>
  
  <p>My fiddle</p>
  
  <p><a href="https://jsfiddle.net/ewumar8d/4/" rel="nofollow noreferrer">https://jsfiddle.net/ewumar8d/4/</a></p>