Skip to content

Instantly share code, notes, and snippets.

@wilson428
Created April 28, 2013 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilson428/5477894 to your computer and use it in GitHub Desktop.
Save wilson428/5477894 to your computer and use it in GitHub Desktop.
An example of using the D3 fisheye lens on an imported SVG
<!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>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment