Skip to content

Instantly share code, notes, and snippets.

@thedataist
Created June 27, 2013 11:57
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 thedataist/5875896 to your computer and use it in GitHub Desktop.
Save thedataist/5875896 to your computer and use it in GitHub Desktop.
Async Talk Examples
{"description":"Async Talk Examples","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"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}
var display = d3.select("#display");
var svg = d3.select("#display").append("svg");
//display.selectAll("p").remove();
display.selectAll("p")
.data([4, 8, 15, 16, 23, 42])
.enter().append("p")
.text(function(d) { return "I’m number " + d + "!"; });
/*
d3.selectAll("p").style("color", "white");
*/
/*d3.selectAll("p").style("color", function() {
return "hsl(" + Math.random() * 360 + ",100%,50%)";
})*/
/*d3.selectAll("p")
.data([4, 8, 15, 16, 23, 42])
.style("font-size", function(d) { return d + "px"; });
*/
/*var container = display.append("div")
.attr("id", "chart1")
.style({width: "500px",
height: "500px",
top: "50px",
left: "10px",
position: "absolute",
"background-color": "white"
})
var svg = container.append('svg');
svg.append('rect').attr({
x: 5,
y: 50,
height: 155,
width: 100,
stroke: "black",
fill: "white"
});
svg.append('circle').attr({
cx: 140,
cy: 50,
r:10,
fill:"blue"});
var data1 = [1,2,3,4,5];
svg.selectAll('circle').data(data1)
.enter().append('circle').attr({
cx: 140,
cy: function(d,i){return d*50},
r:10,
fill:"blue"});
svg.append("svg:svg")
.data([[1, 1.2, 1.7, 1.5, 1.7]])
.attr("x",200)
.attr("width", 150)
.attr("height", 150)
.selectAll("path")
.data(d3.layout.pie())
.enter().append("svg:path")
.attr("transform", "translate(75,75)")
.attr("d", d3.svg.arc().outerRadius(70))
.style("fill",function() {
return "hsl(" + Math.random() * 360 + ",100%,50%)";
})
display.selectAll("p")
.data([4, 8, 15, 16, 23, 42])
.enter().append("p")
.text(function(d) { return "I’m number " + d + "!"; });
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment