Created
April 13, 2015 00:29
-
-
Save luckymike/d9ec1ef3c2daf7bda7d4 to your computer and use it in GitHub Desktop.
Revisions
-
luckymike created this gist
Apr 13, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ Exitstations,RM,EN,EP,NB,BK,AS,MA,19,12,LM,FV,CL,SL,BF,HY,SH,UC,FM,CN,PH,WC,LF,OR,RR,OW,EM,MT,PL,CC,16,24,GP,BP,DC,CM,CV,ED,NC,WP,SS,SB,SO,MB,WD,OA RM,14,133,107,129,459,117,164,165,211,52,99,76,50,38,45,22,26,39,30,13,20,10,9,20,25,310,374,474,351,186,187,38,72,62,18,8,14,8,44,12,33,42,29,8,7 EN,149,20,119,138,966,164,294,499,634,123,148,147,69,57,91,37,44,84,39,22,50,14,14,41,45,891,1059,1002,773,240,195,78,115,103,38,11,38,9,48,30,53,89,63,17,28 EP,115,104,16,72,715,94,141,299,322,77,60,53,31,19,29,10,12,51,19,18,24,13,13,38,19,539,670,427,410,110,58,34,36,43,6,8,25,5,16,9,15,57,29,11,20 NB,127,123,81,21,193,84,104,249,265,76,75,66,35,24,32,12,23,37,21,19,31,13,10,24,20,699,824,459,518,165,101,44,42,33,9,9,17,9,20,7,18,89,39,9,31 BK,500,972,743,216,36,410,471,561,557,266,327,206,173,139,158,84,131,267,145,152,152,89,58,58,108,942,974,855,780,355,287,142,102,115,36,52,109,49,116,31,40,232,150,60,105 AS,113,140,86,86,361,24,105,264,286,81,129,88,47,38,52,26,40,69,25,22,24,10,6,16,33,712,814,514,568,272,144,40,45,41,14,14,27,6,33,10,18,65,45,11,27 MA,169,303,127,106,425,108,30,202,270,90,192,180,122,125,147,67,86,140,146,141,119,52,41,76,80,1023,1195,924,930,407,252,89,106,89,30,28,77,53,228,21,33,102,74,29,34 19,187,495,298,254,528,268,194,40,49,51,176,185,205,190,210,158,212,350,318,334,287,164,111,180,78,1197,1345,908,970,432,296,167,137,146,73,86,211,182,277,71,53,74,134,99,34 12,221,625,308,265,500,266,263,44,44,63,261,343,336,360,318,187,253,391,357,346,268,155,115,182,112,1179,1242,980,985,367,312,184,168,170,121,123,237,179,349,88,93,115,151,130,53 LM,52,119,80,76,256,85,87,47,53,19,185,268,283,271,191,106,125,181,43,24,37,13,11,40,54,821,942,725,611,251,146,63,92,87,11,114,192,26,62,12,18,33,23,85,24 FV,100,145,65,81,319,124,201,176,266,170,28,284,254,273,267,101,91,164,58,24,43,21,27,59,129,844,1009,959,887,335,241,72,100,100,19,65,118,10,65,15,35,64,32,60,15 CL,71,156,54,62,194,99,188,215,350,240,287,22,165,216,221,117,113,267,51,44,56,33,24,48,123,614,602,592,471,177,137,77,93,127,27,68,181,22,108,25,40,29,33,80,25 SL,55,75,33,38,173,51,135,216,349,280,259,176,16,134,209,98,94,139,37,25,25,11,8,34,50,686,684,561,467,134,91,37,68,62,8,54,100,8,48,15,19,36,18,59,8 BF,36,48,19,27,138,41,128,199,352,264,276,227,125,21,183,99,136,249,25,16,19,6,5,16,51,625,654,542,419,126,73,35,55,54,9,73,189,5,31,13,20,20,9,102,6 HY,54,90,31,32,153,60,138,214,313,178,256,218,218,201,19,126,238,398,37,25,29,11,6,21,45,466,493,360,317,110,67,31,44,43,8,27,70,17,62,10,14,24,9,53,10 SH,22,36,11,14,81,25,63,153,174,103,102,106,85,95,105,11,88,168,15,10,12,5,2,10,15,403,378,236,236,71,50,15,19,26,5,22,43,5,19,8,10,13,10,24,6 UC,28,44,15,25,130,46,85,216,241,124,92,112,103,147,237,88,22,206,21,17,18,3,6,12,13,889,813,384,326,71,30,17,26,43,8,20,71,4,20,6,10,27,8,28,16 FM,43,87,51,41,273,69,147,360,378,178,170,268,148,263,420,200,211,53,31,40,23,13,15,35,30,1768,1529,571,474,127,57,29,39,65,9,37,102,10,48,7,8,59,8,36,33 CN,32,37,19,23,142,27,150,314,363,38,59,56,37,27,35,18,21,32,24,121,345,116,48,91,25,915,989,549,488,108,78,52,53,77,24,10,10,61,409,21,28,100,30,6,23 PH,14,22,20,21,146,24,141,309,337,21,21,44,24,16,26,10,18,35,120,26,129,54,33,112,13,1533,1633,629,538,128,65,98,43,65,13,3,7,36,144,21,29,127,25,5,37 WC,24,54,23,31,148,27,129,290,300,32,39,55,25,21,29,15,17,26,379,138,23,73,45,148,19,1312,1353,570,440,110,64,51,36,58,25,7,7,66,259,13,24,148,30,5,36 LF,12,11,13,13,86,8,54,164,159,12,21,33,12,4,8,6,4,14,134,72,87,15,15,88,8,971,907,354,271,53,32,24,13,17,5,3,2,15,44,5,11,73,15,1,16 OR,9,15,11,9,57,9,50,108,122,11,23,22,7,4,8,2,5,15,48,36,45,19,19,63,7,791,758,252,227,44,27,30,13,16,6,2,2,9,20,6,6,57,9,0,13 RR,25,38,43,23,72,17,79,196,217,44,65,45,28,16,24,12,11,35,92,115,146,88,70,20,38,1145,1292,642,643,233,117,59,51,32,5,8,11,23,63,8,19,125,27,6,23 OW,26,48,19,17,95,39,69,83,112,48,135,115,53,54,43,17,13,28,19,14,19,11,6,37,23,1530,1403,975,788,327,191,58,79,46,14,11,27,5,34,14,32,63,30,11,9 EM,384,975,633,764,1093,913,1242,1549,1541,996,1043,654,860,792,582,491,1018,1998,1139,1967,1577,1084,856,1224,1795,163,119,473,540,1072,1697,1243,1560,1250,836,614,1929,588,849,642,568,412,1026,1013,134 MT,408,964,632,667,908,850,1181,1276,1229,944,1050,578,690,710,530,397,817,1549,1004,1615,1238,810,657,1098,1494,133,156,197,512,1439,2,420,1754,2,789,1828,1108,525,1468,491,788,857,772,434,1551,709,96 PL,375,730,331,367,746,427,769,785,849,594,746,510,426,450,296,201,297,473,423,479,451,266,196,471,872,692,309,133,368,1397,1831,1239,2,421,1297,620,233,558,249,510,430,428,1030,704,286,101 CC,306,625,349,417,578,510,787,790,733,539,774,416,383,371,288,214,300,440,402,464,353,233,184,507,769,520,516,327,83,728,1174,890,1527,808,553,225,525,235,498,404,394,470,584,230,55 16,167,192,93,156,339,256,371,408,342,232,314,162,126,115,101,69,63,119,97,113,96,42,37,193,318,1104,1507,1699,803,51,295,397,788,320,170,62,129,65,153,124,137,201,276,56,20 24,163,157,52,100,265,144,238,285,291,136,221,142,83,70,61,50,29,54,69,58,55,25,26,105,205,1492,2,048,2,200,1226,291,95,311,823,312,165,28,82,39,123,108,145,174,269,33,21 GP,38,61,35,41,128,47,83,153,159,60,67,77,39,29,27,13,12,31,46,55,47,16,18,45,58,1136,1469,1403,828,387,309,58,160,84,72,16,51,16,51,46,75,92,152,28,10 BP,62,105,33,44,89,44,96,130,146,88,96,98,65,49,41,25,25,36,49,39,36,15,11,48,93,1392,1880,2,963,1454,743,791,153,78,155,129,17,56,23,66,100,140,105,197,23,8 DC,60,93,43,33,111,41,82,142,169,88,104,130,61,56,45,31,44,57,77,64,55,15,16,29,54,1214,1648,1493,799,319,319,86,169,31,39,27,95,36,74,71,159,182,238,41,9 CM,17,32,7,7,34,12,27,69,115,11,15,21,7,9,7,5,6,7,23,14,25,5,5,5,13,825,998,739,519,171,160,64,135,39,16,2,22,8,27,21,67,91,118,4,2 CV,6,9,7,9,50,11,27,86,116,104,56,73,50,76,28,23,20,33,9,4,8,2,3,7,10,509,518,293,248,62,29,16,15,27,2,10,119,1,5,2,9,17,6,98,8 ED,15,40,24,17,107,26,75,206,215,189,124,175,100,207,69,45,66,103,11,5,6,2,1,14,27,1640,1458,634,577,143,83,55,63,95,22,124,37,1,15,16,14,107,19,40,60 NC,7,10,4,7,43,6,53,172,171,23,10,21,8,6,17,5,4,11,54,36,62,17,9,24,6,467,471,282,265,67,41,18,22,34,9,1,1,14,70,8,13,46,12,1,11 WP,45,50,17,19,116,28,246,264,354,50,69,102,46,32,59,20,19,46,413,142,272,41,25,66,38,688,703,617,608,163,138,59,78,80,28,5,14,77,26,27,49,108,36,7,23 SS,12,27,8,6,29,9,20,68,88,12,12,25,17,14,10,8,5,5,19,20,14,5,5,9,14,627,787,515,398,126,108,44,99,69,18,3,16,8,25,14,40,42,71,6,2 SB,30,50,15,20,39,21,36,55,88,22,35,45,20,20,14,9,10,9,29,26,25,11,7,19,37,587,713,484,406,144,148,77,156,166,78,8,15,15,44,45,13,50,57,5,2 SO,37,88,50,72,134,51,91,76,105,31,52,26,30,16,19,11,19,39,96,122,137,69,60,105,79,387,405,753,379,169,146,83,103,162,100,17,93,52,118,47,48,42,306,31,16 MB,34,62,28,41,153,46,72,126,140,22,30,30,18,8,7,8,5,7,26,21,29,15,10,23,35,988,1417,708,533,251,236,143,212,237,124,7,18,9,32,72,50,349,47,6,6 WD,9,20,13,9,60,15,28,104,127,94,60,86,61,107,52,25,29,35,7,5,4,2,1,7,13,905,750,340,268,67,36,30,25,43,4,108,35,1,7,5,5,33,6,23,27 OA,6,23,21,28,58,25,31,36,51,18,11,47,8,7,9,6,14,27,19,35,29,16,11,18,6,128,101,75,56,17,14,10,8,9,1,7,52,9,21,2,2,20,4,26,18 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,112 @@ <!DOCTYPE html> <html lang ="en"> <head> <meta charset="utf-8"> <title>BART Destinations from Embarcadero - D3 Course</title> <script type="text/javascript" src="http://d3js.org/d3.v3.js"></script> <style type="text/css"> body { } svg { background-color: white; } rect { fill: green; } rect:hover { fill: orange; } .axis path, line { fill: none; stroke: black; shape-rendering: crispEdges; } .axis text { font-family: sans-serif; font-size: 11pt; } .y .domain { stroke: none; } .y line { stroke: none; } </style> </head> <body> <h2>January 2015 BART Destinations for Riders Boarding at Embarcadero</h2> <p>Weekday ridership averages. Source: <a href="http://www.bart.gov/about/reports/ridership">BART</a></p> <script type="text/javascript"> w = 1000 h = 800 topPadding = 20 bottomPadding = 50 leftPadding = 200 rightPadding = 50 var widthScale = d3.scale.linear() .range([ 0, w - (leftPadding + rightPadding) ]); var heightScale = d3.scale.ordinal() .rangeRoundBands([ topPadding , h - bottomPadding ], 0.2); var stationCodes = d3.scale.ordinal() .domain( [ 'RM','EN','EP','NB','BK','AS','MA','19','12','LM','FV','CL','SL','BF','HY','SH','UC','FM','CN','PH','WC','LF','OR','RR','OW','EM','MT','PL','CC','16','24','GP','BP','DC','CM','CV','ED','NC','WP','SS','SB','SO','MB','WD','OA' ] ) .range( [ 'Richmond', 'El Cerrito del Norte', 'El Cerrito Plaza', 'North Berkeley', 'Berkeley', 'Ashby', 'MacArthur', '19th Street', '12th Street', 'Lake Merritt', 'Fruitvale', 'Coliseum', 'San Leandro', 'Bay Fair', 'Hayward', 'South Hayward', 'Union City', 'Fremont', 'Concord', 'Pleasant Hill', 'Walnut Creek', 'Lafayette', 'Orinda', 'Rockridge', 'West Oakland', 'Embarcadero', 'Montgomery', 'Powell Street', 'Civic Center', '16th Street Mission', '24th Street Mission', 'Glen Park', 'Balboa Park', 'Daly City', 'Colma', 'Castro Valley', 'Dublin/Pleasanton', 'North Concord/Martinez', 'Pittsburg/Bay Point', 'South San Francisco', 'San Bruno', 'SFO', 'Milbrae', 'West Dublin/Pleasanton', 'Oakland Airport']) var xAxis = d3.svg.axis() .scale(widthScale) .orient("bottom"); var yAxis = d3.svg.axis() .scale(heightScale) .orient("left"); var svg = d3.select("body") .append("svg") .attr("width", w) .attr("height", h); d3.csv("BART_Weekday_Ridership_January_2015.csv", function(data) { data.sort(function(a,b) { return d3.descending(+a.EM, +b.EM); }); widthScale.domain([ 0, d3.max(data, function(d) { return +d.EM; }) ]); heightScale.domain(data.map(function(d) { return stationCodes(d.Exitstations) })); var bars = svg.selectAll("rect") .data(data) .enter() .append("rect"); bars.attr("x", leftPadding) .attr("y", function(d) { return heightScale(stationCodes(d.Exitstations)); }) .attr("width", function(d) { return widthScale(+d.EM); }) .attr("height", heightScale.rangeBand()) .append("title") .text(function(d) { return stationCodes(d.Exitstations) + "–" + d.EM; }); svg.append("g") .attr("class", "x axis") .attr("transform", "translate(" + leftPadding + "," + (h - bottomPadding) + ")") .call(xAxis); svg.append("g") .attr("class", "y axis") .attr("transform", "translate(" + (leftPadding - 10) + ", 0)") .call(yAxis); }); </script> </body> </html>