[ D3 axis grid lines ] 4528060 by nsonnad
-
-
Save nsonnad/4528060 to your computer and use it in GitHub Desktop.
D3 axis grid lines
This file contains 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
{"description":"An inlet to Tributary","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.6328125,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false} |
This file contains 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
var w = 300, | |
h = 300, | |
x = d3.scale.linear().range([0, w]) | |
y = d3.scale.linear().range([h, 0]) | |
var svg = | |
d3.select("svg") | |
.attr("width", w) | |
.attr("height", h) | |
var xAxis = | |
d3.svg.axis() | |
.scale(x) | |
.tickSize(-h, 0, 0) | |
.orient("bottom") | |
var yAxis = | |
d3.svg.axis() | |
.scale(y) | |
.tickSize(-w, 0, 0) | |
.orient("left") | |
svg.append("g") | |
.attr("transform", "translate(50," + (h + 20) + ")") | |
.call(xAxis) | |
svg.append("g") | |
.attr("transform", "translate(50, 20)") | |
.call(yAxis) |
This file contains 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
body { font:10px sans-serif;} | |
line.tick { stroke: #cccccc; fill:none; shape-rendering: crispEdges;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment