Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Created January 30, 2015 00:01
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 ramnathv/60ee159cae663f80f0f4 to your computer and use it in GitHub Desktop.
Save ramnathv/60ee159cae663f80f0f4 to your computer and use it in GitHub Desktop.
Use of SVG Def
{"description":"Use of SVG Def","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true}
svg = d3.select("svg")
.attr("width", 600)
.attr("height", 400)
.append("g")
.attr("transform", "translate(58, 50)")
svg.append("def")
.append("rect")
.attr("id", "myrect")
.attr("width", 40)
.attr("height", 20)
.attr("fill", "none")
.attr("stroke", "darkred")
.attr("rx", 6)
.attr("ry", 6)
svg.append("use")
.attr("x", 20).attr("y", 72)
.attr("xlink:href", "#myrect")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment