Can I move an SVG element between SVG groups, in d3.js

后端 未结 4 2006
心在旅途
心在旅途 2020-12-10 14:24

Can I move an SVG element between SVG groups - without stirring too much calculation behind the scenes nor crafting too much code in my own code? The d3 api documentation me

4条回答
  •  醉梦人生
    2020-12-10 15:09

    Perhaps you could do this, with multiple elements:

    d3.select('#btn').on('click', function() {
      circle.remove()
        .each(function(){
        group2.node().appendChild(d3.select(this).node());
      });
    });
    

    jsFiddle

提交回复
热议问题