[ Launch: survey response ] 9696583 by enjalot
[ Launch: survey response ] 9695711 by lesliewright
-
-
Save enjalot/9696583 to your computer and use it in GitHub Desktop.
survey response
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
{"description":"survey response","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"survey.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/JJdd0iT.png"} |
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
// google docs: survey form link | |
//https://docs.google.com/forms/d/1Xpkv0q9xMydP5c39nHlQrhh-I_DGm-qBejki-WMkwu0/viewform | |
// bitly survey link | |
//bit.ly/1mkXb9o | |
var results = tributary.survey; | |
var re = new RegExp(" ", "g") | |
results.forEach(function(d) { | |
d.time = new Date(d.time); | |
d.exp = +d.exp; | |
d.age = +d.age || 0; | |
d.gender = +d.gender; | |
d.comm = d.comm.replace(re, '-'); | |
d.fb = d.fb.replace(re, '-'); | |
d.device = d.device.replace(re, '-'); | |
d.computer = d.computer.replace(re, '-'); | |
d.net = d.net.replace(re, '-'); | |
d.selfie = d.selfie.replace(re, '-'); | |
d.first = d.first.replace(re, '-'); | |
}) | |
//console.log(results[0]); | |
//time,exp,age,gender,comm,fb,device,computer,net,selfie,first | |
var datamap = { | |
time: {q:"Timestamp"}, | |
exp: {q:"How many years have you been developing for the web?"}, | |
age: {q:"How old are you?"}, | |
gender: {q: "Male or Female", a: ["Male", "Female"]}, | |
comm: {q: "How do you prefer to communicate?", a: ["Phone", "Text", "Email", "Chat"]}, | |
fb: {q: "How often do you check Facebook?", a: ["Alot", "Often", "Occasionally", "Never"]}, | |
device: {q: "What type of device are you using right now?", a: ["Smartphone", "Laptop", "Macbook", "iPad/Tablet"]}, | |
computer: {q: "How many computers do you own?", a: ["1", "2", "3 or more"]}, | |
net: {q: "How long do you spend on the internet everyday", a: ["Less than 1 hour", "Between 1 and 4 hours", "All day"]}, | |
selfie: {q: "Have you ever taken a 'selfie' just to post online?", a: ["Yes", "No"]}, | |
first: {q: "What's the first thing you do in the morning?", a: [ "Check phone", "Check Facebook", "Start coding", "Get coffee"]} | |
} | |
var fields = Object.keys(datamap); | |
var linearScale = d3.scale.linear() | |
.domain(d3.extent(results, function(d) { return d.age })) | |
.range([0, 500]) | |
var ordinalScale = d3.scale.ordinal() | |
.domain(d3.range(results.length)) | |
.rangeBands([0, 500], 0.2) | |
var svg = d3.select("svg") | |
var rects = svg.selectAll("rect") | |
.data(results) | |
rects.enter().append("rect") | |
rects | |
.attr({ | |
width: ordinalScale.rangeBand(), | |
height: function(d) { return linearScale(d.age) }, | |
x: function(d,i) { return 105 + ordinalScale(i) }, | |
y: function(d) { return 100 + linearScale.range()[1] - linearScale(d.age) } | |
}) |
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
time | exp | age | gender | comm | fb | device | computer | net | selfie | first | |
---|---|---|---|---|---|---|---|---|---|---|---|
3/21/2014 10:09 | 5 | 32 | Male | Text | Occasionally | Smartphone | 2 | All day | Yes | Get coffee | |
3/21/2014 10:10 | 10 | 42 | Female | Chat | Often | Laptop | 1 | Between 1 and 4 hours | Yes | Check your phone | |
3/21/2014 10:11 | 6 | 35 | Male | Text | Alot | Smartphone | 3 or more | Between 1 and 4 hours | No | Get coffee | |
3/21/2014 10:12 | 8 | 48 | Female | Text | Never | Laptop | 2 | All day | No | Get coffee | |
3/21/2014 11:18 | 2 | 22 | Male | Chat | Occasionally | iPad/Tablet | 1 | Between 1 and 4 hours | Yes | Get coffee | |
3/21/2014 11:19 | 4 | 37 | Female | Phone | Alot | Macbook | 2 | Between 1 and 4 hours | Yes | Check Facebook | |
3/21/2014 11:19 | 15 | 38 | Male | Text | Occasionally | Smartphone | 3 or more | All day | Yes | Start coding | |
3/21/2014 11:20 | 1 | 25 | Female | Often | Laptop | 1 | Between 1 and 4 hours | No | Get coffee | ||
3/21/2014 11:21 | 12 | 46 | Male | Chat | Alot | Macbook | 3 or more | All day | No | Start coding | |
3/21/2014 11:21 | 18 | 49 | Female | Text | Never | Smartphone | 2 | Between 1 and 4 hours | Yes | Check phone |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment