Last active
January 11, 2017 22:00
-
-
Save ludwigschubert/d02a0250bb45f724ba2594b561ca91d1 to your computer and use it in GitHub Desktop.
d3-single-brush
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<meta title="Minimal D3 v4 single brush example--Ludwig Schubert for Stanford CS448b"> | |
<style> | |
.grid-background { | |
fill: #eee; | |
} | |
.grid line, | |
.grid path { | |
fill: none; | |
stroke: #000; | |
shape-rendering: crispEdges; | |
} | |
</style> | |
<body> | |
<script src="http://d3js.org/d3.v4.min.js"></script> | |
<script> | |
var margin = { top: 10, right: 10, bottom: 10, left: 10 }, | |
width = 960 - margin.left - margin.right, | |
height = 500 - margin.top - margin.bottom; | |
var svg = d3.select("body").append("svg") | |
.attr("width", width + margin.left + margin.right) | |
.attr("height", height + margin.top + margin.bottom) | |
.append("g") | |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); | |
svg.append("rect") | |
.attr("class", "grid-background") | |
.attr("width", width) | |
.attr("height", height); | |
d3.brush(svg); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment