Skip to content

Instantly share code, notes, and snippets.

@jpmarindiaz
Created April 13, 2013 19:24
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 jpmarindiaz/5379708 to your computer and use it in GitHub Desktop.
Save jpmarindiaz/5379708 to your computer and use it in GitHub Desktop.
Tributary inlet
{"description":"Tributary inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"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 estData = [];
var est1Data = [], est2Data = [];
var resEstms = data.lines;
var resEst1 = resEstms.pdf;
var resEst1X = resEst1.x;
var resEst1Y = resEst1.y;
var est1Length = resEst1X.length;
for (var i = 0; i < est1Length; i++) {
est1Data.push({ "title": "Estimate 1", "x": resEst1X[i], "y": resEst1Y[i] });
}
estData.push(est1Data);
var margin = { top: 20, right: 10, bottom: 20, left: 10 };
var width = 600 - margin.left - margin.right,
height = 300 - margin.top - margin.bottom;
var x = d3
.scale
.linear()
.domain([0, 120])
.range([0, width]),
y = d3
.scale
.linear()
.domain([-0.01, 0.01])
.range([height, 0]),
color = d3
.scale
.category10(),
line = d3
.svg
.line()
.interpolate("basis")
.x(function (d, i) { return x(d.x); })
.y(function (d, i) { return y(d.y * 1.2); });
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.orient("left").ticks(3);
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+40) + "," + margin.top + ")");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment