2

I can easily append a circle object using D3.js as follow :

var bodySelection = d3.select("body");
var svgSelection = bodySelection.append("svg")
                            .attr("width", 50)
                            .attr("height", 50);

var circleSelection = svgSelection.append("circle")
                            .attr("cx", 25)
                            .attr("cy", 25)
                            .attr("r", 25)
                            .style("fill", "purple");

My question is, is it possible to append my own svg object and how ?

The result should look a little something like this:

var bodySelection = d3.select("body");
var svgSelection = bodySelection.append("svg")
                            .attr("width", 50)
                            .attr("height", 50);

var myObjSelection = svgSelection.append("MyObject")
                            .attr("MyObjectAttribute1", 25)
                            .attr("MyObjectAttribute2", 25)
JSmith
  • 4,519
  • 4
  • 29
  • 45

0 Answers0