1

Do you know why doing this with d3 display a circle:

node.append("circle")

But not this:

node.append(function () {
  return document.createElement("circle");
})

The DOM result is exactly the same, but the circle is not visible in the second case

1 Answer 1

3

The element is created in the wrong namespace -- you need to explicitly specify the SVG namespace for this to work, as Javascript doesn't infer it automatically:

return document.createElementNS(d3.ns.prefix.svg, "circle");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.