Skip to content Skip to sidebar Skip to footer

Problems When Using The Insert() Function In D3 Java Library When Trying To Insert Svg Elements Before Another

I have problems using the insert() function of the d3 visualization library. Better to say I do not understand how to use the 'before selector'. I red the examples here and here, b

Solution 1:

EDIT: Try passing an id to the before select, as shown here: http://jsfiddle.net/GCTuD/3/

var rect1 = group.insert("svg:rect", "#foreign_object")

You cannot select by element tag name, only by constants (such as an id), as specified in the docs:

The name and before selector must be specified as constants, though in the future we might allow inserting of existing elements or a function to generate the name or selector dynamically.

Post a Comment for "Problems When Using The Insert() Function In D3 Java Library When Trying To Insert Svg Elements Before Another"