Skip to content

Instantly share code, notes, and snippets.

@svenhofstede-zz
Last active August 29, 2015 14:11
Show Gist options
  • Save svenhofstede-zz/c7f4924bcb8ca117670a to your computer and use it in GitHub Desktop.
Save svenhofstede-zz/c7f4924bcb8ca117670a to your computer and use it in GitHub Desktop.
Random_circle_example
var svg = d3.select("svg")
var circle = svg.append("circle")
circle.attr("cx",500)
.attr("cy",300)
.attr("r",87)
.attr("fill","#ff6575")
.attr("stroke","#606060")
.attr("stroke-width",35)
circle.on("mouseover",function(){
selected = d3.select(this);
var initialSize = selected.attr("r");
selected
.attr("r",parseInt(initialSize,10)+50);
})
circle.on("mouseout",function(){
selected = d3.select(this);
var initialSize = selected.attr("r");
selected
.attr("r",parseInt(initialSize,10)-50);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment