Skip to content

Instantly share code, notes, and snippets.

@sfrdmn
sfrdmn / index.html
Created November 30, 2011 22:17
Mouse over example in d3
<html>
<head>
<meta charset="utf-8">
<title>Mouse Over</title>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/fe671a70e236710412a514fa276e59f875f3c617/d3.js"></script>
</head>
<body>
<script type="text/javascript">
// width
var w = 800;
@sfrdmn
sfrdmn / bar_chart.js
Created October 26, 2011 23:51
Polished Bar Chart
// If you rename your script, don't forget to change the <script> tag in the HTML file!!!
var w = 800; // width
var h = 300; // height
var marginT = 0;
var marginL = 75;
var marginB = 10;
var marginR = 20;
// this is relavant to my data only.
@sfrdmn
sfrdmn / data.csv
Created October 19, 2011 20:14
DAI 523 - Even More Bar Chart 10/19
label area
max 23
jenny 456
lenny 567
mark 345
angel 34
aurelio 21
@sfrdmn
sfrdmn / data.csv
Created October 17, 2011 16:44
DAI 523 - Bar Chart Cont. 10/17
label area
ca 23
ma 456
ne 567
ba 345
ya 34
na 21
@sfrdmn
sfrdmn / gist:1282451
Created October 12, 2011 20:33
DAI 523 - Bar Chart 10/12
// If you rename your script, don't forget to change the <script> tag in the HTML file!!!
var w = 800; // width
var h = 600; // height
var marginT = 20;
var marginL = 20;
/*
First append SVG to the body
*/
@sfrdmn
sfrdmn / gist:1263780
Created October 5, 2011 06:17
DAI 523 - Bubble Chart Skeleton Round 2
/*
Hey. We're going to continue with this bubble chart we were working on last class.
Here is some motivational ASCII.
,. _~-., . YOU'RE BEAUTIFUL!
~'`_ \/,_. \_
/ ,"_>@`,__`~.) | .
| | @@@@' ",! . . '
|/ ^^@ .! \ | /
@sfrdmn
sfrdmn / gist:1249346
Created September 28, 2011 21:46
DAI523 - Bubble Chart Skeleton
/*
Yo doods. This code creates a bubble chart. It's unfinished, so you gotta finish it.
Use the comments I left to figure things out. Comments are specified by two slashes //
Multiple line comments begin with /asterix and end with asterix/
Commented code does not run.
;\
|' \
_ ; : ;
/ `-. /: : |
@sfrdmn
sfrdmn / gist:1233257
Created September 21, 2011 20:48
DAI523 - D3 - Binding data and creating graphs
d3.select("body").append("svg:svg").attr("width", 3000).attr("height",500);
var chart = d3.select("svg");
var fill = d3.scale.category20();
d3.json("data/dataset1.json", function(json) {
var size = function(d,i) {
return d.size;
}
@sfrdmn
sfrdmn / gist:1233255
Created September 21, 2011 20:48
DAI 523 - 9/21 - Modify SVG
// The following line selects all circles on the page and changes their stroke-width to 10 (px)
d3.selectAll("circle").attr("stroke-width", 10)
// Two slashes means "comment". Commented code is not run.
// It is good to comment your code so you remember what's going on.
// d3.selectAll("circle").attr("fill", "blue");
// The following lines deal with making selections and then sub selections within those selections
d3.selectAll("circle").attr("stroke-width", 10);
d3.select("#blue").selectAll("circle").attr("stroke","rgb(34,56,35)");
@sfrdmn
sfrdmn / gist:1227514
Created September 19, 2011 20:27
DAI 523 - SVG Examples
<!-- DELETE ME -->