Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Created July 27, 2012 16:49
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 gabrielflorit/3189104 to your computer and use it in GitHub Desktop.
Save gabrielflorit/3189104 to your computer and use it in GitHub Desktop.
created by livecoding - http://livecoding.gabrielflor.it
svg {
background: #262626;
}
path {
stroke: white;
fill: red;
stroke-width: 20;
}
var width = $('svg').width();
var height = $('svg').height();
var svg = d3.select('svg');
var g;
var line;
svg
.attr('width', width)
.attr('height', height);
g = svg.append('g');
line = d3.svg.line()
.x(function(d) { return d.x; })
.y(function(d) { return d.y; });
g.append('path')
.attr('d', line([
{
"x": 0,
"y": 0
},
{
"x": 100,
"y": 100
}
]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment