Skip to content

Instantly share code, notes, and snippets.

@markarios
Last active March 25, 2016 11:35
Show Gist options
  • Select an option

  • Save markarios/0e378d85c7b80e06daf8 to your computer and use it in GitHub Desktop.

Select an option

Save markarios/0e378d85c7b80e06daf8 to your computer and use it in GitHub Desktop.
play
{"description":"play","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},"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,"tab":"edit","display_percent":0.7,"thumbnail":"http://i.imgur.com/Z4ghHZY.png","fullscreen":false,"ajax-caching":true}
function point(i) {
return {i:i, x: i / 19, y: (Math.sin(i / 3) + 2) / 4}
}
var data = d3.range(2).map(function(i) {
return point(i)});
console.log(data)
var margin = {top: 10, right: 10, bottom: 30, left: 10},
width = 681 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var x = d3.scale.linear()
.domain([0, 1])
.range([0, width]);
var y = d3.scale.linear()
.domain([0, 1])
.range([height, 0]);
//var xAxis = d3.svg.axis()
// .scale(x)
// .orient("bottom");
//var yAxis = d3.svg.axis()
// .scale(y)
// .orient("left");
var line = d3.svg.line()
// .interpolate(function(points) { return points.join("A 1,1 0 0 1 "); }) // custom interpolator
.x(function(d) { return x(d.x); })
.y(function(d) { return y(d.y); });
var svg = d3.select("svg")
svg
.datum(data)
.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("g")
// .attr("class", "x axis")
// .attr("transform", "translate(0," + height + ")")
// .call(xAxis);
// svg.append("g")
// .attr("class", "y axis")
// .call(yAxis);
svg.append("path")
.attr("class", "line")
.attr("d", line);
//svg.selectAll(".dot")
// .data(data)
// .enter().append("circle")
// .attr("class", "dot")
// .attr("cx", line.x())
// .attr("cy", line.y())
// .attr("r", 3.5);
body {
font: 10px sans-serif;
}
.axis path, .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.line {
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
}
.dot {
fill: white;
stroke: steelblue;
stroke-width: 1.5px;
}
svg {
margin-left:20px;
}
@fuoco8theking
Copy link
Copy Markdown

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment