Skip to content

Instantly share code, notes, and snippets.

@vjpgo
Created February 1, 2013 16:20
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 vjpgo/4692303 to your computer and use it in GitHub Desktop.
Save vjpgo/4692303 to your computer and use it in GitHub Desktop.
Tributary inlet
{"description":"Tributary inlet","endpoint":"","display":"svg","public":true,"require":[{"name":"D3 v3","url":"http://d3js.org/d3.v3.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"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}
var m = [10, 10, 20, 10],
w = 960 - m[1] - m[3],
h = 80 - m[0] - m[2],
x = d3.scale.linear().domain([.05, .95]).range([0, w]),
y = d3.scale.linear().range([0, h]);
var svg = d3.select("body").append("svg:svg")
.attr("width", w + m[1] + m[3])
.attr("height", h + m[0] + m[2])
.append("svg:g")
.attr("transform", "translate(" + m[3] + "," + m[0] + ")");
svg.append("svg:g")
.attr("class", "x minor")
.attr("transform", "translate(0," + h + ")")
.call(d3.svg.axis().scale(x).tickSubdivide(2).tickSize(-6));
svg.append("svg:g")
.attr("class", "x axis")
.attr("transform", "translate(0," + h + ")")
.call(d3.svg.axis().scale(x));
body {
font: 10px sans-serif;
}
line, path {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.minor :not(.minor) {
display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment