Skip to content

Instantly share code, notes, and snippets.

View mbecica's full-sized avatar

Mary Becica mbecica

View GitHub Profile
@mbecica
mbecica / geojsoncoord.js
Created November 28, 2011 05:11
geojson snippet
"coordinates":[[[-66.957694,18.033618],[-66.886493,18.022664],[-66.859109,17.956941],[-66.979601,17.951464],[-66.957694,18.033618]]]
@mbecica
mbecica / svgpath.html
Created November 28, 2011 05:12
svg path sample
<path d="M744.1534383841184,193.616946467692L747.1888469973278,195.23574405456822L747.1888469973278,195.23574405456822L745.3188209130827,199.7816924159337L742.2587567863515,198.06332395926597Z">
@mbecica
mbecica / d3-circle-map-sample.js
Created November 28, 2011 05:23
d3 circles on map projection
d3.json("data/earthquakes.json", function(r) {
points.selectAll("circle")
.data(r.features)
.enter().append("svg:circle")
.attr("r", 10)
.attr("cx", function(d){return map(d.geometry.coordinates)[0];})
.attr("cy", function(d){return map(d.geometry.coordinates)[1];})
});
@mbecica
mbecica / svgcircle.html
Created November 28, 2011 05:32
svg circle sample
<circle r="2.4805369252913003" cx="187.32936" cy="133.25479729699975"></circle>
@mbecica
mbecica / geojsonpoint.js
Created November 28, 2011 05:34
geojson point
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]}
@mbecica
mbecica / d3projection.js
Created November 28, 2011 05:42
d3 projection
var map = d3.geo.mercator(),
projection = d3.geo.path().projection(map);
// Define the size of the grid
var rX = 35,
rY = 45;
// Draw the canvas
var canvas = document.getElementById("chart"),
ctx = canvas.getContext('2d');
_(data).each(function(d, i) {
// For every column
rX*Math.pow(c/max, 1/4)
@mbecica
mbecica / bd_groups.js
Created April 7, 2012 22:20
pack to force-directed transition
$(function() {
var w = $('#container').width()/2,
h = w,
format = d3.format(",d"),
fill = d3.scale.category20b(),
padding = 2,
radius = d3.scale.sqrt().range([0, 12]);
var vis = d3.select("#main").append("svg:svg")
@mbecica
mbecica / countryStream.json
Created May 21, 2012 06:40
foreign stream
[{"values":[{"y":23716034,"x":57},{"y":0,"x":51},{"y":0,"x":0},{"y":0,"x":15},{"y":0,"x":10},{"y":0,"x":42},{"y":0,"x":43},{"y":0,"x":40},{"y":0,"x":41},{"y":0,"x":2},{"y":0,"x":39},{"y":0,"x":22},{"y":0,"x":23},{"y":0,"x":34},{"y":0,"x":35},{"y":0,"x":18},{"y":0,"x":19},{"y":0,"x":20},{"y":0,"x":21},{"y":0,"x":14},{"y":0,"x":1},{"y":0,"x":16},{"y":0,"x":17},{"y":0,"x":32},{"y":20992334,"x":59},{"y":0,"x":38},{"y":0,"x":9},{"y":0,"x":8},{"y":0,"x":11},{"y":0,"x":3},{"y":0,"x":5},{"y":0,"x":4},{"y":0,"x":7},{"y":0,"x":6},{"y":0,"x":36},{"y":0,"x":13},{"y":0,"x":12},{"y":0,"x":37},{"y":0,"x":45},{"y":0,"x":44},{"y":0,"x":47},{"y":0,"x":46},{"y":0,"x":49},{"y":0,"x":48},{"y":0,"x":33},{"y":0,"x":50},{"y":23000,"x":53},{"y":0,"x":52},{"y":0,"x":29},{"y":0,"x":28},{"y":0,"x":27},{"y":0,"x":26},{"y":0,"x":25},{"y":0,"x":24},{"y":40000,"x":56},{"y":0,"x":31},{"y":40000,"x":54},{"y":33000,"x":55},{"y":22759157,"x":60},{"y":23837625,"x":61},{"y":21226897,"x":58},{"y":0,"x":30},{"y":26832356,"x":62},{"y":26202923,"x":6