Skip to content

Instantly share code, notes, and snippets.

@ahlusar1989
Last active November 3, 2015 16:33
Show Gist options
  • Save ahlusar1989/c4c80b0cfacaf4845b3c to your computer and use it in GitHub Desktop.
Save ahlusar1989/c4c80b0cfacaf4845b3c to your computer and use it in GitHub Desktop.
Clickable Line Setup
{"description":"Clickable Line Setup","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,"ajax-caching":true,"thumbnail":"http://i.imgur.com/f00wg8N.png"}
var svg = d3.select("svg");
var data = [
{x: 0, y: 0},
{x: -2, y: 42},
{x: 14, y: 0},
{x: 20, y: 50},
{x: 30, y: 100},
{x: 40, y: 300},
{x: 50, y: 30},
{x: 96, y: 52},
{x: 143, y: 170}
];
var line = d3.svg.line()
.x(function(d) {
return d.x;
})
.y(function(d) {
return d.y;
});
var group = svg.append("g")
.attr({
transform: "translate(" + [268, 131] + ")"
})
var path = group.append("path")
.attr({
d: line(data),
fill: "none",
stroke: "#000000"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment