This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.
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
//paste in the console to swap out the d3.scale.category20() pallet | |
var oldColors = oldColors ? oldColors : d3.scale.category20().range() | |
var newColors = oldColors.map(function(){ | |
return '#'+Math.floor(Math.random()*16777215).toString(16) }) | |
oldColors.forEach(function(str, i){ | |
//update inline color style | |
d3.selectAll('[style*="' + str + '"]') | |
.style('fill', newColors[i]) | |
.style('background-color', newColors[i]) |
- xfce
- chrome
- sublime http://www.sublimetext.com/
- package manager https://packagecontrol.io/
- node, npm
http://bost.ocks.org/mike/block/
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Photobooth</title> | |
<style> | |
.blur { | |
-webkit-filter: blur(3px); | |
} |
Slightly modified scatter plot example for NYC D3 talk.
See also Scatter II and Scatter III.
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
function headTails(a, n){ | |
var breaks = [] | |
while(a.length){ | |
var avg = mean(a) | |
breaks.push(avg) | |
a = a.filter(function(d){ return d > avg }) | |
} | |
return breaks | |
} |
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
function fetchSongInfo(track) { | |
info('Getting song info for ' + track.name + ' by ' + track.artists[0].name); | |
var url = 'http://developer.echonest.com/api/v4/track/profile?api_key=N6E4NIOVYMTHNDM8J&callback=?'; | |
var track_id = fromSpotify(track.uri); | |
$.getJSON(url, { id: track_id, format:'jsonp', bucket : 'audio_summary'}, function(data) { | |
if (checkResponse(data)) { | |
info(""); | |
showTrackInfo(data.response.track); | |
fetchAnalysis(data.response.track); |
OlderNewer