forked from mikedewar/d3talk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
final shift around and addition of slides
- Loading branch information
Showing
12 changed files
with
328 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | ||
<link type="text/css" rel="stylesheet" href="prettify.css"> | ||
<script type="text/javascript" src="prettify.js"></script> | ||
<link type="text/css" rel="stylesheet" href="style.css"> | ||
<title></title> | ||
</head> | ||
<body onload="prettyPrint()"> | ||
<div id="body"> | ||
<div id="header"> | ||
<h1>elements of a d3 viz:</h1> | ||
<div style="margin-left:auto; margin-right:auto; width:850px; padding-top:0.5em"> | ||
<ul> | ||
<li>json: data</li> | ||
<li>html: structure</li> | ||
<li>javascript+d3: layout</li> | ||
<li>css: teh pretty</li> | ||
</ul> | ||
|
||
<span style="font-size:1.8em;">JSON + HTML + JS + CSS</span> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | ||
<link type="text/css" rel="stylesheet" href="prettify.css"> | ||
<script type="text/javascript" src="prettify.js"></script> | ||
<link type="text/css" rel="stylesheet" href="style.css"> | ||
<title></title> | ||
</head> | ||
<body onload="prettyPrint()"> | ||
<div id="body"> | ||
<pre class="prettyprint"> | ||
<body> | ||
<ul> | ||
<li>44 people specify 0 topics</li> | ||
<li>6 people specify 1 topic</li> | ||
<li>1 person specifies 2 topics</li> | ||
<li>3 people specify 3 topics</li> | ||
<li>1 person specifies 4 topics</li> | ||
... | ||
</ul> | ||
</body> | ||
</pre> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | ||
<link type="text/css" rel="stylesheet" href="prettify.css"> | ||
<script type="text/javascript" src="prettify.js"></script> | ||
<link type="text/css" rel="stylesheet" href="style.css"> | ||
<title></title> | ||
</head> | ||
<body onload="prettyPrint()"> | ||
<div id="body"> | ||
<pre class="prettyprint" > | ||
<body> | ||
<svg> | ||
<rect y="0" width="484" height="24"></rect> | ||
<rect y="27" width="66" height="24"></rect> | ||
<rect y="54" width="11" height="24"></rect> | ||
<rect y="81" width="33" height="24"></rect> | ||
... | ||
</svg> | ||
</body> | ||
</pre> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | ||
<link type="text/css" rel="stylesheet" href="prettify.css"> | ||
<script type="text/javascript" src="prettify.js"></script> | ||
<link type="text/css" rel="stylesheet" href="style.css"> | ||
<title></title> | ||
</head> | ||
<body onload="prettyPrint()"> | ||
<div id="body"> | ||
<pre class="prettyprint"> | ||
<html> | ||
<head> | ||
<script type="text/javascript" | ||
src="http://mbostock.github.com/d3/d3.js"> | ||
</script> | ||
</head> | ||
<body> | ||
<script> | ||
d3.json( | ||
"http://localhost:8000/data.json", | ||
function(data){...} | ||
) | ||
</script> | ||
</body> | ||
</html> | ||
</pre> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | ||
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script> | ||
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js"></script> | ||
|
||
<link type="text/css" rel="stylesheet" href="prettify.css"> | ||
<script type="text/javascript" src="prettify.js"></script> | ||
<link type="text/css" rel="stylesheet" href="style.css"> | ||
|
||
|
||
<title>egovis</title> | ||
|
||
|
||
|
||
</head> | ||
<body onload="prettyPrint()"> | ||
<div id="body"> | ||
<div style="height:300px; width:750px; margin-left:auto; margin-right:auto; margin-top:1em" id="graph"> | ||
</div> | ||
<pre style="font-size:0.7em" class="prettyprint"> | ||
|
||
node.append('svg:image') | ||
.attr('x', 0).attr('y', 0) | ||
.attr('width', 40).attr('height', 40) | ||
.attr('xlink:href', function(d){return d.photo_url}) | ||
|
||
force.on("tick", function() { | ||
node.attr("transform", | ||
function(d){return "translate(" + d.x + "," + d.y + ")";}); | ||
}); | ||
|
||
|
||
</pre> | ||
<script> | ||
|
||
var w = 750, | ||
h = 300, | ||
fill = d3.scale.category20(); | ||
|
||
vis = d3.select("#graph") | ||
.append("svg") | ||
|
||
d3.json( | ||
'http://localhost:8000/data/hackr_event.json', | ||
function(json){ | ||
|
||
|
||
var force = d3.layout.force() | ||
.charge(-50) | ||
.nodes(json.nodes) | ||
.size([w, h]) | ||
.start(); | ||
|
||
var node = vis.selectAll("g") | ||
.data(json.nodes) | ||
.enter().append("g") | ||
.attr("id", function(d){ return d.name;}) | ||
.attr("class", "node") | ||
.attr("x", function(d) { return d.x; }) | ||
.attr("y", function(d) { return d.y; }) | ||
.call(force.drag); | ||
|
||
node.append('svg:image') | ||
.attr('x', 0) | ||
.attr('y', 0) | ||
.attr('width', 40) | ||
.attr('height', 40) | ||
.attr('xlink:href', function(d){return d.photo_url}) | ||
|
||
force.on("tick", function() { | ||
node.attr( | ||
"transform", | ||
function(d) { return "translate(" + d.x + "," + d.y + ")"; } | ||
); | ||
}); | ||
|
||
d3.select("#chart").on("click", function() { | ||
console.log('click') | ||
json.nodes.forEach(function(o, i) { | ||
o.x += (Math.random() - .5) * 50; | ||
o.y += (Math.random() - .5) * 50; | ||
}); | ||
force.resume(); | ||
}); | ||
|
||
}) | ||
|
||
</script> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.