292 lines
8.6 KiB
PHP
292 lines
8.6 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
|
<meta charset="utf-8">
|
|
<title>Surge pricing varaition in downtown core</title>
|
|
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
|
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
|
<script src="assets/js/jquery.popupoverlay.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
|
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
|
<style>
|
|
[class*="fa-"]:before {
|
|
font-family: 'FontAwesome', sans-serif;
|
|
}
|
|
</style>
|
|
<style id="compiled-css" type="text/css">
|
|
#ui-datepicker-div { font-size: 12px; }
|
|
</style>
|
|
<style>
|
|
/* Always set the map height explicitly to define the size of the div
|
|
* element that contains the map. */
|
|
#map {
|
|
height: 80vh;
|
|
}
|
|
/* Optional: Makes the sample page fill the window. */
|
|
html, body {
|
|
height: 100%;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
</style>
|
|
<script src="assets/js/luxon.min.js"></script>
|
|
<script src="assets/js/Chart.min.js"></script>
|
|
<script src="assets/js/chartjs-adapter-luxon.js"></script>
|
|
<script src="assets/js/chartjs-chart-financial.js" type="text/javascript"></script>
|
|
<script src="assets/js/utils.js"></script>
|
|
<style>
|
|
canvas {
|
|
-moz-user-select: none;
|
|
-webkit-user-select: none;
|
|
-ms-user-select: none;
|
|
}
|
|
td:hover{
|
|
cursor: pointer;
|
|
}
|
|
col:first-child {background: #FFD}
|
|
col:nth-child(2n+3) {background: #FFD}
|
|
tr:first-child {background: #DDF}
|
|
tr:nth-child(2n+3) {background: #DDD}
|
|
th {
|
|
text-align: center;
|
|
}
|
|
.well {
|
|
/* drop-shadow is better than box-shadow as it add a shadow to tooltip arrows arrow as well,
|
|
however drop-shadow dramatically affects the performance of transition animation on Android. */
|
|
/* filter: drop-shadow(0 0 10px rgba(0,0,0,0.3)); */
|
|
display:none;
|
|
margin:1em;
|
|
max-width: 90%;
|
|
}
|
|
.well .popup_close {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0px;
|
|
border-radius: 2px;
|
|
background: none;
|
|
border: 0;
|
|
font-size: 25px;
|
|
padding: 0 10px;
|
|
}
|
|
|
|
.tv-content {
|
|
display: none;
|
|
}
|
|
.tv-radio {
|
|
display: none;
|
|
}
|
|
.tv-radio:checked + .tv-content {
|
|
display: block;
|
|
}
|
|
.tv-tab {
|
|
display: inline-block;
|
|
cursor: pointer;
|
|
padding: 8px;
|
|
}
|
|
.tv-tab:hover {
|
|
opacity: 0.9;
|
|
}
|
|
body {
|
|
margin: 40px;
|
|
font-family: 'Georgia';
|
|
background-color: #ffffee;
|
|
}
|
|
.tv-tabs {
|
|
color: #ecf0f1;
|
|
}
|
|
.tv-tabs :nth-child(odd) {
|
|
background-color: #2c3e50;
|
|
}
|
|
.tv-tabs :nth-child(even) {
|
|
background-color: #34495e;
|
|
}
|
|
.tv-content {
|
|
padding: 10px;
|
|
min-width: 600px;
|
|
min-height: 600px;
|
|
}
|
|
#tv-tab-1 + .tv-content {
|
|
background-color: #ffffff;
|
|
color: #ecf0f1;
|
|
}
|
|
#tv-tab-2 + .tv-content {
|
|
background-color: #ffffff;
|
|
color: #ecf0f1;
|
|
}
|
|
#tv-tab-3 + .tv-content {
|
|
background-color: #ffffff;
|
|
color: #ecf0f1;
|
|
}
|
|
#tv-tab-4 + .tv-content {
|
|
background-color: #ffffff;
|
|
color: #000000;
|
|
}
|
|
#tv-tab-5 + .tv-content {
|
|
background-color: #ffffff;
|
|
color: #000000;
|
|
}
|
|
a,
|
|
.tv-link {
|
|
display: inline-block;
|
|
padding: 2px;
|
|
color: #f1c40f;
|
|
background-color: rgba(255,255,255,0.2);
|
|
box-shadow: 1px 1px 5px rgba(255,255,255,0.2);
|
|
transition: all 0.4s ease-in-out;
|
|
}
|
|
a:hover,
|
|
.tv-link:hover {
|
|
background-color: transparent;
|
|
box-shadow: none;
|
|
}
|
|
ul {
|
|
list-style-type: binary;
|
|
}
|
|
pre {
|
|
display: block;
|
|
overflow: hidden;
|
|
padding: 8px;
|
|
background-color: rgba(0,0,0,0.2);
|
|
}
|
|
code {
|
|
display: block;
|
|
margin-top: -10px;
|
|
margin-left: -40px;
|
|
}
|
|
.progress {
|
|
width:100px;
|
|
height: 100%;
|
|
}
|
|
.progress-wrap {
|
|
background: #dcdcdc;
|
|
margin: 20px 0;
|
|
overflow: hidden;
|
|
position: relative;
|
|
|
|
}
|
|
.progress-bar {
|
|
background:#249c23;
|
|
left: 0;
|
|
position: absolute;
|
|
top: 0;
|
|
width:0%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<!-- Wrap all page content in a page container (optional, but recommended for screen readers and iOS*) -->
|
|
<div id="page">
|
|
<div id="loader">Loading data
|
|
<div id="progress" class="progress-wrap progress"
|
|
data-progresspercent="0"
|
|
data-height="10px"
|
|
data-width="150px"
|
|
data-speed="1500"
|
|
data-color="3a9c23">
|
|
<div class="progress-bar progress"></div>
|
|
</div>
|
|
</div>
|
|
<div id="dfilter" style="display:none">
|
|
<form method="get" action="?">
|
|
<select name="t"><? foreach ($providers as $key=>$val) { ?><option value="<?=$key?>"<?= $key==$t ? ' selected' : '' ?>><?=$val?></option><? } ?></select>
|
|
<select name="area1"><? foreach ($areas as $key=>$val) { ?><option value="<?=$key?>"<?= $key == $area1 ? ' selected' : '' ?>><?=$val?></option><? } ?></select>
|
|
<select name="area2"><? foreach ($areas as $key=>$val) { ?><option value="<?=$key?>"<?= $key == $area2 ? ' selected' : '' ?>><?=$val?></option><? } ?></select>
|
|
<input type="text" id="date1" name="date1" value="<?= $date1 ?>" />
|
|
<input type="text" id="date2" name="date2" value="<?= $date2 ?>" />
|
|
<input type="submit" value="filter"/>
|
|
</form>
|
|
<br/>
|
|
</div>
|
|
<div id="tabs" class="tv-tabs" style="display:none">
|
|
<label class="tv-tab" for="tv-tab-1"><?= $providers[$t] ?>: <?= $label1 ?></label>
|
|
<label class="tv-tab" for="tv-tab-2"><?= $providers[$t] ?>: <?= $label2 ?></label>
|
|
<label class="tv-tab" for="tv-tab-5">Map</label>
|
|
<label class="tv-tab" for="tv-tab-3">Comparison</label>
|
|
<label class="tv-tab" for="tv-tab-4">Data</label>
|
|
</div>
|
|
<input class="tv-radio" id="tv-tab-1" name="tv-group" type="radio" checked="checked"/>
|
|
<div class="tv-content">
|
|
<div style="width:75%">
|
|
<canvas id="canvas1"></canvas>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<input class="tv-radio" id="tv-tab-2" name="tv-group" type="radio"/>
|
|
<div class="tv-content">
|
|
<div style="width:75%">
|
|
<canvas id="canvas2"></canvas>
|
|
</div>
|
|
</div>
|
|
<input class="tv-radio" id="tv-tab-5" name="tv-group" type="radio"/>
|
|
<div class="tv-content">
|
|
<div id="map"></div>
|
|
</div>
|
|
<input class="tv-radio" id="tv-tab-3" name="tv-group" type="radio"/>
|
|
<div class="tv-content">
|
|
<div style="width:75%;color:#000000!important;">
|
|
<div id="dataRes1"></div><br/>
|
|
<div id="dataRes2"></div><br/>
|
|
<div style="width:75%">
|
|
<canvas id="canvas3"></canvas>
|
|
</div>
|
|
<table>
|
|
<col><col><col><col><col><col>
|
|
<tr><th>NN</th><th>Travel Date</th><th>Time</th><th>Cost</th><th>Trend</th><th>Delta</th><th>Variation</th></tr>
|
|
<? $j=1; $dMax = 0; $dMin = 0; $tVar = []; $tVar0 = []; foreach ($data1 as $i=>$f) { $d = variation($data1,$i,$f,$pub1); ?>
|
|
<tr>
|
|
<td><?= $j++ ?></td>
|
|
<td><?= strtok($f['travel_date'],'+') ?></td>
|
|
<td><?= $f['time'] ?></td>
|
|
<td><?= sprintf("%0.02f", $f['cost']) ?></td>
|
|
<td><?= sprintf("%0.02f", $d[0]) ?></td>
|
|
<td><?= sprintf("%0.02f", $d[1]) ?></td>
|
|
<td><?= sprintf("%0.02f", $d[2]) ?></td>
|
|
</tr>
|
|
<? } ?>
|
|
<tr>
|
|
<td colspan="7"><div id="dataSrc1"><?= $label1.": ".sprintf("%0.02f",$dMin).' / '.sprintf("%0.02f",$dMax).' ~ '.stats_variance($tVar) ?></div></td>
|
|
</tr>
|
|
<? $tVar1 = $tVar0; $dMax = 0; $dMin = 0; $tVar = []; $tVar0 = []; foreach ($data2 as $i=>$f) { $d = variation($data1,$i,$f,$pub2); ?>
|
|
<tr>
|
|
<td><?= $j++ ?></td>
|
|
<td><?= strtok($f['travel_date'],'+') ?></td>
|
|
<td><?= $f['time'] ?></td>
|
|
<td><?= sprintf("%0.02f", $f['cost']) ?></td>
|
|
<td><?= sprintf("%0.02f", $d[0]) ?></td>
|
|
<td><?= sprintf("%0.02f", $d[1]) ?></td>
|
|
<td><?= sprintf("%0.02f", $d[2]) ?></td>
|
|
</tr>
|
|
<? } ?>
|
|
<? $tVar2 = $tVar0; ?>
|
|
<tr>
|
|
<td colspan="7"><div id="dataSrc2"><?= $label2.": ".sprintf("%0.02f",$dMin).' / '.sprintf("%0.02f",$dMax).' ~ '.stats_variance($tVar) ?></div></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<input class="tv-radio" id="tv-tab-4" name="tv-group" type="radio"/>
|
|
<div class="tv-content">
|
|
<script>
|
|
|
|
document.getElementById('dataRes1').innerHTML = document.getElementById('dataSrc1').innerHTML;
|
|
document.getElementById('dataRes2').innerHTML = document.getElementById('dataSrc2').innerHTML;
|
|
|
|
function updateProgress() {
|
|
var progress = $("#progress");
|
|
var getPercent = progress.attr("data-progresspercent");
|
|
var getSpeed = parseInt(progress.attr("data-speed"));
|
|
var getColor = progress.attr("data-color");
|
|
var getHeight = progress.attr("data-height");
|
|
var getWidth = progress.attr("data-width");
|
|
progress.css({"height":getHeight,"width":getWidth});
|
|
progress.find(".progress-bar").css({"background-color":"#"+getColor}).animate({ width:getPercent+'%' },getSpeed);
|
|
if (getPercent<100) setTimeout(updateProgress,500);
|
|
}
|
|
updateProgress();
|
|
</script>
|