This file contains hidden or 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
var moment = require('moment'); | |
var data = require('./one-week.json'); | |
var t = {}; | |
data.forEach(function(d) { | |
var segments = d.segments; | |
segments.forEach(function(s) { | |
var activities = s.activities; | |
activities.forEach(function(a) { |
This file contains hidden or 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
var width = 740, | |
height = 550; | |
var projection = d3.geo.mercator() | |
.translate([375, 330]) | |
.scale(160) | |
var color = d3.scale.linear() | |
.domain([0, 1500000]) | |
.range(["#ffcc00", "red"]) |
This file contains hidden or 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
var redElectron = { | |
theta: 0, | |
draw: function() { | |
if (redElectron.theta > Math.PI*2) { | |
redElectron.theta = 0; | |
} | |
if (redElectron.theta > Math.PI) { | |
var removed = d3.selectAll('.red-electron').remove(); | |
d3.selectAll('.red-far').append(function() { | |
return removed.node(); |
This file contains hidden or 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
var colours = [0xCD853F, 0x191970, 0xDAA520]; | |
var container; | |
var camera, scene, projector, renderer; | |
var particleMaterial; | |
var width = 740; | |
var height = 350; | |
var objects = []; | |
function init() { | |
container = $("#webgl"); |
This file contains hidden or 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
var chart = circularHeatChart() | |
.numSegments(24) | |
.radialLabels(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]) | |
.segmentLabels(["Midnight", "1am", "2am", "3am", "4am", "5am", "6am", "7am", "8am", "9am", "10am", "11am", "Midday", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm", "9pm", "10pm", "11pm"]) | |
.margin({top: 20, right: 0, bottom: 20, left: 80}) | |
.innerRadius(30) | |
.segmentHeight(20) | |
.range(["orange", "magenta"]) | |
var data = []; |
This file contains hidden or 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
d3.json('/data/bvg-graph.json', function(json){ | |
var width = 740, | |
height = 600; | |
var svg = d3.select('svg') | |
.style("display", "block") | |
.attr('width', width) | |
.attr('height', height); |
This file contains hidden or 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
var w = 500, | |
var h = 300, | |
var svg = d3.select("svg") | |
.attr("width", w) | |
.attr("height", h) | |
.style("background-color", "#fefefe") | |
.style("display", "block"); | |
var circle = svg.selectAll("circle") | |
.data([19,30,18,20,22,29]); |
This file contains hidden or 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
cat stores.txt | jq '.[] | .store_state+","+.title' | tr -d '"' | header -a "State,Store" | csvsql --query 'SELECT State,count(*) AS Count FROM stdin group by State order by Count desc' | csvlook |
This file contains hidden or 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
ggplot(mpg, aes(x = cty, y = hwy, color = factor(cyl))) + | |
geom_jitter() + | |
labs(x = "City mileage/gallon", | |
y = "Highway mileage/gallon", | |
color = "Cylinders") + theme_ice() |
This file contains hidden or 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
library("ggplot2"); | |
library("grid"); | |
theme_ice <- function () | |
{ | |
theme( | |
text = element_text(size=16, family="Ubuntu Condensed"), | |
plot.title = element_text(size=16, family="Ubuntu Condensed"), | |
legend.title = element_text(size=14, family="Ubuntu Condensed", face = "italic"), | |
legend.position = c(.9, .5), |