Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active June 10, 2016 14:19
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 mbostock/15a9eecf0b29db92f12ca823cfbbce0a to your computer and use it in GitHub Desktop.
Save mbostock/15a9eecf0b29db92f12ca823cfbbce0a to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.overlay {
fill: green;
}
</style>
<body>
<script src="https://d3js.org/d3.v4.0.0-alpha.45.min.js"></script>
<script>
var svg = d3.select("body")
.append("svg")
.attr("width", 960)
.attr("height", 500);
svg.append("g")
.call(d3.brush()
.on("start brush end", function() {
text
.interrupt()
.text(d3.event.type)
.style("fill-opacity", 1)
.transition()
.delay(500)
.style("fill-opacity", 0);
}));
var text = svg.append("text")
.attr("x", "50%")
.attr("y", "50%")
.attr("dy", ".35em")
.attr("font-size", 20)
.attr("pointer-events", "none");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment