Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created April 23, 2013 20:51
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 roundrobin/5447280 to your computer and use it in GitHub Desktop.
Save roundrobin/5447280 to your computer and use it in GitHub Desktop.
sin waves
{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":600,"height":300,"hide":false},"description":"sin waves","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.svg":{"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,"thumbnail":"http://i.imgur.com/UO9qAUz.png"}
var data = [
1,2,4,5,1,2,4,5, 1,2,4,5
];
var svg = d3.select('svg');
var type = 'grand-challenges';
var x = 73;
var y = 0;
var radius = 208;
var gcGroup = svg.selectAll('.'+type)
.data(data)
.enter();
var amplitdute = 2.91821986863514;
var stauching = 1;
var direction = -1;
var distance = 44;
var gc = gcGroup.append('g')
.attr({
transform: function(d, i){
var i = i - (data.length-1)/2;
var x = Math.pow(amplitdute*(i),2)+(i*stauching)+127;
var y = 397+(distance * i);
return 'translate('+(x)+','+(y)+')';
},
'class': type
});
gc.append("rect")
.attr({
width: 46,
height: 15,
rx: 0,
ry: 0
});
gc.append('text')
.text("Lorem Ipsum")
.attr({
fill: "#000000",
x : 80,
y: 12,
"font-size": 10,
"font-family": "Arial",
"text-anchor": "middle"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment