Commit 93be7ec0 authored by Jasin's avatar Jasin

Show more information on statsMain & styling statsMain

parent 077beabd
......@@ -39,6 +39,6 @@ else
}
else
{
header("Location: ../main?data=" . $response);
header("Location: ../main?data=" . $response ."&lineLabel=" . $_GET['LineLabel'] . "&amount=" . $_GET['Time'] . "&method=" . $_GET['Method']);
}
}
\ No newline at end of file
......@@ -40,7 +40,7 @@
<div class="input-group">
<label for="Method">Methode</label>
<select name="Method" id="Method">
<option value="LineByTime">Nach Linien sortiert</option>
<option value="LineByTime">Nach Linien sortiert, alle Verspätungen addiert pro Tag</option>
<option disabled class="disabled" value="LineByTime">Nach Zeitpunkten sortiert (Bald Verfügbar)</option>
<option disabled class="disabled" value="LineByTime">Nach Haltestellen sortiert (Bald Verfügbar)</option>
</select>
......
......@@ -11,7 +11,19 @@
<link rel="stylesheet" href="stats.css">
</head>
<body>
<canvas id="myChart"></canvas>
<div class="wrapper">
<div class="container">
<canvas class="mainChart" id="myChart"></canvas>
</div>
<div class="container">
<div class="row">
<small id="methodInfo"></small>
</div>
<div class="row">
<button class="button">Weitere Daten hinzufügen</button>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
......@@ -22,6 +34,8 @@
{
dataLoader(null, null, true);
});
//TODO: add button "add line"
</script>
</body>
</html>
\ No newline at end of file
body
{
background-color: #18bc9c;
}
.form-control
{
width: 100%;
}
.wrapper
{
background: white;
height: 90%;
margin: 2%;
}
#methodInfo
{
font-family: 'Lato', sans-serif;
color: grey;
}
button
{
width: 50%;
margin-left: 25%;
margin-top: 20px;
margin-bottom: 2%;
background-color: #18bc9c;
color: white;
border: 3px solid #18bc9c;
border-radius: 25px;
-webkit-transition: 0.5s !important;
transition: 0.5s !important;
-webkit-transition: 0.3s ease-in-out !important;
transition: 0.3s ease-in-out !important;
}
button:hover
{
width: 55%;
margin-left: 22.5%;
background-color: white;
color: #18bc9c;
-webkit-transition: 0.5s !important;
transition: 0.5s !important;
-webkit-transition: 0.3s ease-in-out !important;
transition: 0.3s ease-in-out !important;
}
\ No newline at end of file
......@@ -21,7 +21,6 @@ function addDataSet(delays, name)
};
chartConfig.data.datasets.push(Dataset);
window.myChart.update();
}
function initChart(config)
......@@ -38,7 +37,8 @@ let chartConfig =
labels: [],
datasets: []
},
options: {
options:
{
title:
{
display: true
......@@ -50,6 +50,8 @@ function dataLoader(lineLabel, amount, first)
{
if(first === true)
{
let methodInfoLabel = document.getElementById("methodInfo");
let method = findGetParameter("method");
let response = findGetParameter("data");
response = JSON.parse(response);
......@@ -62,15 +64,25 @@ function dataLoader(lineLabel, amount, first)
}
let labels = [];
for(let e = 0; e < amount; e++)
for(let e = 0; e < findGetParameter("amount"); e++)
{
labels.push(response[e].created);
}
chartConfig.data.labels = labels;
initChart(chartConfig);
addDataSet(dataDelays, lineLabel);
addDataSet(dataDelays, findGetParameter("lineLabel"));
switch (method)
{
case "LineByTime":
methodInfoLabel.textContent = "Methode: Verspätung nach Linien sortiert. Alle erfassten Verspätungen pro Tag aufsummiert";
break;
default:
methodInfoLabel.textContent = "Methode: Nicht erfasst.";
}
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment