[ Launch: activities ] 11119223 by poezn
-
-
Save poezn/11119223 to your computer and use it in GitHub Desktop.
activities
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":"activities","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data.json":{"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},"styles.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data2.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/gFzMfZ6.png","inline-console":true} |
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
{ | |
"walking": [53,3667,8457,5386,1700,3215,4054,3259,1877,4423,7787,7958,11093,884,6115,2046,8502,9466,2825,6927,4556,11567,1852,6379,5533,3420,2146,2130,6378,6056,5806,8143,14053,6294,5096,1866,3439,8828,5274,4931,6789,4840,6702,5845,6264,9310,4697,2832,3282,5603,1076,9908,6135,12357,3743,7536,5585,6210,8248,9497,10109,7173,3601,10082,4729,6478,8264,4261,6646,2929,5473,4594,2704,6227,4469,1683,7650,4497,4020,844,5994,10244,7857,7870,4482,4745,15509,3553,1454,7964,4812,5729,6457,3808,7350,1504,8158,6530,7517,3770,1469,5538,3015,7041,3413,5113,7939,9247,10555,2069,7161,5883,3844,3160,7343,6817,5730,151,5681,4551,2639,1404,2026,1555,637,1410,925,1083,2526,2875,1390,1080,990,1337,4846,9880,1395,6119,4483,8209,7850,4516,5274,1327,5163,2999,967,2278,1596,583,7935,5338,2994,821,5706,690,5668,1005,3160,2125,2511,1081,2259,1661,773,4056,10048,4231,791,971,4417,5121,2539,1849,1785,5798,1683,931,2162,1934,18390,7805,1197,1298,3920,1420,6908,6298,10098,2164,4167,2308,5230,8186,2568,7820,2662,974,1321,1460,3419,5840,1713,3067,6663,2119,1153,7631,814,10538,9541,2535,2113,1765,5211,2607,3855,7342,4487,4134,2293,2094,1958,7214,1623,3762,3129,2278,3317,3581,9602,3701,13474,3534,4552,4095,6053,4429,2501,1416,5409,3139,8365,3274,3994,5867,2337,3512,1826,3767,4053,6612,7585,3953,5110,6532,6125,6185,7222,4875,972,2159,1579,1123,565,6348,770,3794,5387,6449,12262,1166,4649,2275,1248,1128,3316,3025,3790,10347,2645,2099,4104,3086,5941,5391,1357,1003,1315,2848,13899,2811,7270,12528,1538,2973,1590,3348,3618,2735,9162,3442,1232,2386,2841,6623,1272,5616,3715,3354,736,7961,4083,3732,3199,683,2132,6831,1421,7416,3447,9197,1049,1887,1818,2477,4145,225,5148,847,7139,634,4033,9202,6113,13110,697,2989,961,5490,11321,3206,8606,1495,4887,6952,3710,8408,15350,8127,15579,8530,6842,13551,3167,2862,5703,935,5131,2224,664,3310,7757,15004,2056,1317,6188,1706,5822,5413,4606,4440,1229,793,2022,5106], | |
"cycling": [0,0,0,0,0,0,0,0,0,0,0,0,0,13759,0,17294,0,0,0,0,13665,0,13269,0,0,0,637,13809,0,0,0,0,0,0,0,13796,0,0,0,10944,993,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2428,0,0,0,0,0,20086,0,0,0,0,0,0,14236,7460,0,0,0,0,0,18765,1020,14941,0,0,0,0,19525,0,1299,0,0,0,0,0,1338,0,0,0,0,0,0,592,0,0,0,0,0,1042,0,638,0,0,0,0,1445,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12144,0,0,12530,0,13284,14950,0,644,0,12848,0,14079,0,14680,0,0,15020,16727,17719,19088,18632,0,0,0,14994,14606,18618,16684,0,0,0,15588,15981,14671,21419,0,0,0,15138,16242,0,2199,0,0,0,16970,1497,17090,0,0,0,0,18790,0,14561,14861,0,0,14676,14650,19472,16787,14612,0,0,0,7342,7498,15198,19859,0,0,14682,0,11369,15288,14647,0,0,0,0,0,0,16008,0,0,0,0,3571,0,23205,5273,5594,0,0,17479,14314,8862,5824,0,0,8984,8210,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22602,17637,17316,21295,0,0,0,0,17561,17892,17911,9853,4213,19234,21202,17640,0,0,0,0,0,17704,24931,19312,0,0,0,0,0,17435,0,0,0,0,0,19184,0,19560,0,0,2201,0,17791,0,11230,23359,0,0,0,17281,0,8500,9311,0,0,0,0,0,18964,0,0,0,0,17499,0,16913,17668,0,0,0,24553,0,8500,18780,0,0,0,0,0,0,0,0,0,0,17406,0,20729,18574,0,0,0,19277,0,15355,31960,0,0,3279,1526,18803,17267,0,0], | |
"running": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], | |
"transport": [0,11180,51361,11013,12488,51715,12234,54906,19425,179951,16622,18020,59535,0,52743,0,51031,14363,104132,0,0,55395,0,53670,11611,57224,15352,56571,69810,15213,50259,97396,194879,27372,9665,24190,15990,21125,48735,0,29219,8545,34287,15136,12114,10633,14978,0,4965,163759,0,52053,53869,0,24315,6398,2607363,13678,12961,0,1408,2607578,9623,16532,3589,0,11581,15007,33613,12144,14017,7163,0,22186,5326,13593,10508,10587,756,0,0,58488,146272,200088,11619,0,11835,8066,46223,13470,13340,9917,19349,13102,11377,24373,14496,11942,12009,17390,373,19728,0,5340,8661,16813,12136,11073,10182,53687,5457,10556,14717,10183,10755,10939,20126,0,13594,0,0,0,0,0,0,11454,0,0,0,9558,89932,432,6753,0,55777,0,3682,14371,0,10298,58508,10734,12697,5808,0,12232,0,0,0,0,8923,0,86329,0,14698,0,150037,0,0,18395,0,0,0,0,0,8093,0,0,0,0,385,0,9982,13310,3602,385,634,0,1129,41393,14711,0,0,0,139452,0,24932,0,0,0,20173,1136,16935,22004,0,0,20154,127553,0,0,222846,0,0,0,13220,0,0,0,0,0,115862,10699,1162,756,49966,288044,0,41292,0,0,0,0,135201,0,17272,144540,17586,0,7827,22838,0,138012,12039,32755,7556,0,0,58341,20069,0,8363,13769,17356,14613,15171,6590,8124,5311072,6728709,38777,11888,23610,15028,91570,28598,16561,165075,177295,25798,8923468,41338,37486,9616,18395,14962,28060,2796,39357,3672381,23651,20284,13564,10058,7297,0,0,0,18992,19411,0,0,0,994,55241,17988,22073,0,0,0,0,0,9716,53378,0,0,1096,0,19590,7181,11040,0,23369,0,26733,21231,15113,0,11421,0,26076,0,0,0,0,124046,0,1433,0,0,6290,69490,13216,0,27368,7619,7216,24977,9504,8673,0,25716,0,135524,20945,6979,0,0,31216,0,0,4335,0,16975,0,145574,17636,3144,4499025,1587,0,108177,122833,114719,88504,81982,4514362,0,0,146710,0,0,0,23599,0,15069,133105,52289,0,78849,90086,15241,19781,116392,0,0,11666] | |
} |
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
[53,3667,8457,5386,1700,3215,4054,3259,1877,4423,7787,7958,11093,884,6115,2046,8502,9466,2825,6927,4556,11567,1852,6379,5533,3420,2146,2130,6378,6056,5806,8143,14053,6294,5096,1866,3439,8828,5274,4931,6789,4840,6702,5845,6264,9310,4697,2832,3282,5603,1076,9908,6135,12357,3743,7536,5585,6210,8248,9497,10109,7173,3601,10082,4729,6478,8264,4261,6646,2929,5473,4594,2704,6227,4469,1683,7650,4497,4020,844,5994,10244,7857,7870,4482,4745,15509,3553,1454,7964,4812,5729,6457,3808,7350,1504,8158,6530,7517,3770,1469,5538,3015,7041,3413,5113,7939,9247,10555,2069,7161,5883,3844,3160,7343,6817,5730,151,5681,4551,2639,1404,2026,1555,637,1410,925,1083,2526,2875,1390,1080,990,1337,4846,9880,1395,6119,4483,8209,7850,4516,5274,1327,5163,2999,967,2278,1596,583,7935,5338,2994,821,5706,690,5668,1005,3160,2125,2511,1081,2259,1661,773,4056,10048,4231,791,971,4417,5121,2539,1849,1785,5798,1683,931,2162,1934,18390,7805,1197,1298,3920,1420,6908,6298,10098,2164,4167,2308,5230,8186,2568,7820,2662,974,1321,1460,3419,5840,1713,3067,6663,2119,1153,7631,814,10538,9541,2535,2113,1765,5211,2607,3855,7342,4487,4134,2293,2094,1958,7214,1623,3762,3129,2278,3317,3581,9602,3701,13474,3534,4552,4095,6053,4429,2501,1416,5409,3139,8365,3274,3994,5867,2337,3512,1826,3767,4053,6612,7585,3953,5110,6532,6125,6185,7222,4875,972,2159,1579,1123,565,6348,770,3794,5387,6449,12262,1166,4649,2275,1248,1128,3316,3025,3790,10347,2645,2099,4104,3086,5941,5391,1357,1003,1315,2848,13899,2811,7270,12528,1538,2973,1590,3348,3618,2735,9162,3442,1232,2386,2841,6623,1272,5616,3715,3354,736,7961,4083,3732,3199,683,2132,6831,1421,7416,3447,9197,1049,1887,1818,2477,4145,225,5148,847,7139,634,4033,9202,6113,13110,697,2989,961,5490,11321,3206,8606,1495,4887,6952,3710,8408,15350,8127,15579,8530,6842,13551,3167,2862,5703,935,5131,2224,664,3310,7757,15004,2056,1317,6188,1706,5822,5413,4606,4440,1229,793,2022,5106] |
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
var raw_data = tb.data; | |
var activities = ["walking", "cycling", "running", "transport"] | |
var colors = ["#00d55a", "#00cdec", "#f660f4", "#848484"]; | |
var data = _.chain(activities) | |
.map(function(d, i) { | |
return _.chain(raw_data[d]) | |
.groupBy(function(d, i) { | |
return Math.floor(i/7) | |
}) | |
.values() | |
.map(function(d) { return d3.sum(d) }) | |
.value() | |
}) | |
.value() | |
var scaleX = _.map(activities, function(d, i) { | |
return d3.scale.linear() | |
.domain([0, data[i].length]) | |
.range([0, 370]); | |
}) | |
var scaleXOrd = _.map(activities, function(d, i) { | |
return d3.scale.ordinal() | |
.domain(d3.range(data[i].length)) | |
.rangeRoundBands([0, 370]); | |
}); | |
var scaleY = _.map(activities, function(d, i) { | |
return d3.scale.linear() | |
.domain([0, d3.max(data[i])]) | |
.range([40, 0]); | |
}); | |
var scaleOpacity = _.map(activities, function(d, i) { | |
return d3.scale.linear() | |
.domain([0, d3.max(data[i])]) | |
.range([0, 1]); | |
}); | |
var line = d3.svg.line() | |
.x(function(d, i) { | |
return scaleX(i) | |
}) | |
.y(function(d, i) { | |
return scaleY(d); | |
}) | |
.interpolate("basis"); | |
var activities = g.selectAll("g.activity") | |
.data(data) | |
.enter().append("g") | |
.attr({ | |
"class": "activity", | |
"transform": function(d, i) { | |
return "translate(0 " + (i*50) + ")" | |
} | |
}); | |
activities.append("path") | |
.attr({ | |
"d": function(d, i) { | |
var sx = scaleX[i]; | |
var sy = scaleY[i]; | |
var line = d3.svg.line() | |
.x(function(d, i) { | |
return sx(i) | |
}) | |
.y(function(d, i) { | |
return sy(d); | |
}) | |
.interpolate("basis"); | |
return line(d) | |
}, | |
"fill": "none", | |
"stroke": function(d, i) { | |
return colors[i]; | |
}, | |
"stroke-width": 3, | |
"transform": "translate(50,50)" | |
}) | |
gBars = activities.append("g") | |
.attr({ | |
"transform": "translate(453,60)" | |
}); | |
gBars.selectAll("rect") | |
.data(function(d, i) { return d }) | |
.enter().append("rect") | |
.attr({ | |
"width": scaleXOrd[0].rangeBand(), | |
"height": 20, | |
"fill": function(d, i, p) { | |
return colors[p]; | |
}, | |
"transform": function(d, i, p) { | |
var tx = scaleXOrd[p](i), | |
ty = 0; | |
return "translate(" + [tx, ty] + ")" | |
}, | |
"opacity": function(d, i, p) { | |
return scaleOpacity[p](d) | |
} | |
}) |
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
#display { | |
background-color: #000; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment