Skip to content

Instantly share code, notes, and snippets.

@krish85
Last active August 29, 2015 14:27
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 krish85/b63d99996025c9f4c4a0 to your computer and use it in GitHub Desktop.
Save krish85/b63d99996025c9f4c4a0 to your computer and use it in GitHub Desktop.
Circle Color change
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
</head>
<body>
<script type="text/javascript">
var svg = d3.select("body")
.append("svg")
.attr("width", 400)
.attr("height", 400);
svg.append("circle")
.style("stroke", "gray")
.style("fill", "white")
.attr("r", 50)
.attr("cx", 200)
.attr("cy", 200)
.on("mouseover", function(){d3.select(this).style("fill", "teal");})
.on("mouseout", function(){d3.select(this).style("fill", "white");});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment