From: Maxious Date: Tue, 20 Mar 2012 23:34:01 +0000 Subject: Multidimensional bus delay analysis X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=073b8b4d2a645ad7ac3ca589615870a8335bd870 --- Multidimensional bus delay analysis --- --- a/.gitmodules +++ b/.gitmodules @@ -10,4 +10,9 @@ [submodule "js/yepnope"] path = js/yepnope url = https://github.com/SlexAxton/yepnope.js.git - +[submodule "javascripts/tesseract"] + path = javascripts/tesseract + url = https://github.com/square/tesseract.git +[submodule "javascripts/d3"] + path = javascripts/d3 + url = https://github.com/mbostock/d3.git --- /dev/null +++ b/labs/busdelay.csv.php @@ -1,1 +1,52 @@ +prepare(' +SELECT * from myway_timingdeltas' + , array(PDO::ATTR_CURSOR => PDO::FETCH_ORI_NEXT)); +$query->execute(); +$errors = $conn->errorInfo(); +if ($errors[2] != "") { + die("Export terminated, db error" . print_r($errors, true)); +} + +$headers = Array("date", "delay", "distance", "origin", "destination"); + +$fp = fopen('php://output', 'w'); +if ($fp && $query) { + //header('Content-Type: text/csv'); + header('Pragma: no-cache'); + header('Expires: 0'); + fputcsv($fp, $headers); + while ($r = $query->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) { + $row = Array(); + foreach ($headers as $i => $fieldName) { + switch ($fieldName) { + case "date": + $row[] = date("dm",strtotime($r['date'])).date("Hi",strtotime($r['time'])); + break; + case "delay": + $row[] = $r['timing_delta']; + break; + case "distance": + $row[] = $r['stop_sequence']; + break; + case "origin": + $row[] = $r['myway_stop']; + break; + case "destination": + $row[] = $r['route_name']; + break; + default: + break; + } + } + fputcsv($fp, array_values($row)); + } + die; +} +?> + + --- /dev/null +++ b/labs/busdelay.php @@ -1,1 +1,498 @@ - + + +Tesseract + + + +
+
+
Time of Day
+
+
+
Arrival Delay (min.)
+
+
+
Distance (mi.)
+
+
+
Date
+
+
+ + + +
+
+
+ + + + + + + + +