Skip to content

Instantly share code, notes, and snippets.

@k-izzo
Created August 4, 2014 17: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 k-izzo/aee304a355bbf6f283d6 to your computer and use it in GitHub Desktop.
Save k-izzo/aee304a355bbf6f283d6 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":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/ipR7wKv.png"}
var color = d3.scale.category10();
var vis = d3.select('svg')
.append('g')
.attr('transform', 'translate(50,50)');
var w = 400,
h = 300
var data = d3.range(10)
vis
.append('rect')
.attr({
x: 0,
y: 0,
width: w,
height: h
})
.style({
fill: 'lightblue',
'fill-opacity': 0.5
})
var rows = vis.selectAll('.row')
.data(data)
.enter()
.append('g')
.attr('transform', function (d) { return 'translate(' + [0, 30 + 30*d] + ')'; })
var prod_name = rows.append('text').text('hello')
function line(container, d) {
container.append('line')
.attr({
x1: 0,
y1: 0,
x2: 100,
y2: 0
})
.style({
stroke: color(d),
fill: 'none'
})
}
line(d3.selectAll('g'), function (d) { console.log(d); return d; })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment