Last active
February 22, 2020 09:21
-
-
Save mbostock/1014829 to your computer and use it in GitHub Desktop.
External SVG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<script src="https://d3js.org/d3.v4.js"></script> | |
<script> | |
d3.xml("rect01.svg").mimeType("image/svg+xml").get(function(error, xml) { | |
if (error) throw error; | |
document.body.appendChild(xml.documentElement); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I know the question is kinda far in the past but perhaps it'll help someone:
The way I did it was (note that this is d3v5):
With d3.select().append() it did not work in my case.
I don't know if my approach is best practice but it certainly works.