Created
April 28, 2013 18:30
-
-
Save wilson428/5477894 to your computer and use it in GitHub Desktop.
An example of using the D3 fisheye lens on an imported 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
</style> | |
<body> | |
<script src="d3.min.js"></script> | |
<script> | |
/*global d3 */ | |
var width = 600, | |
height = 500; | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height) | |
.append("g") | |
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")"); | |
d3.xml("robo_face.svg", "image/svg+xml", function(xml) { | |
var image = document.importNode(xml.documentElement, true); | |
svg.append(image.node()); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment