score:26

Accepted answer

Unless I'm misunderstanding the question, you should be able to control the size of the SVG simply by using CSS. So, with d3, rather than using attr() use style():

layer.append("svg")
  .style("width", width1 + 'px')
  .style("height", height1 + 'px');

Similarily, you'd control the position with .style("left", ...) and .style("top", ...), presuming your svg is absolutely positioned.


Related Query