better graphs
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
This commit is contained in:
@ -57,7 +57,6 @@ class Smart extends Page {
|
||||
|
||||
$this->set('results_dogs', $results);
|
||||
$this->set('dogs', $dogs);
|
||||
$this->set('query', $query);
|
||||
$this->set('template', 'search.html.php');
|
||||
|
||||
}
|
||||
|
@ -37,8 +37,7 @@
|
||||
<?php foreach ($results as $res) :
|
||||
// graph data preparation
|
||||
|
||||
if ($res['bew'] != 'DIS' && $res['punkte'] != 'DIS')
|
||||
{
|
||||
if ($res['bew'] != 'DIS' && $res['punkte'] != 'DIS') {
|
||||
$sdata['dates'][] = date("d.m.Y", strtotime($res['date']));
|
||||
$sdata['speed'][] = $res['msek'] ?: 0;
|
||||
$sdata['errors'][] = $res['f'] ?: 0;
|
||||
@ -71,88 +70,47 @@
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<?php if (count($results) > 0) : ?>
|
||||
<div class="col">
|
||||
<div id="graph<?= $dog ?>" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div>
|
||||
<div class="row">
|
||||
<?php if (count($results) > 0) : ?>
|
||||
<div class="col">
|
||||
<?= partial('graph.html.php', [
|
||||
'id' => 'graph1'.$dog,
|
||||
'title' => 'Fehler und Verweigerungen',
|
||||
'xaxis' => $sdata['dates'],
|
||||
'seriesdata' => [
|
||||
['name' => 'Fehler', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['errors']],
|
||||
['name' => 'Verweigerungen', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['refusals']],
|
||||
],
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Initialize the echarts instance based on the prepared dom
|
||||
var myChart = echarts.init(document.getElementById('graph<?= $dog ?>'));
|
||||
<div class="col">
|
||||
<?= partial('graph.html.php', [
|
||||
'id' => 'graph2'.$dog,
|
||||
'title' => 'Geschwindigkeit',
|
||||
'xaxis' => $sdata['dates'],
|
||||
'seriesdata' => [
|
||||
['name' => 'Geschwindigkeit', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['speed']],
|
||||
],
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
|
||||
// Specify the configuration items and data for the chart
|
||||
var option = {
|
||||
title: {
|
||||
text: 'Stacked Line'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit', 'Punkte', 'Platz']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: <?= json_encode($sdata['dates']); ?>
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [{
|
||||
name: 'Geschwindigkeit',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['speed']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Fehler',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['errors']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Verweigerungen',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['refusals']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Zeit',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['time']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Punkte',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['points']); ?>
|
||||
},
|
||||
{
|
||||
name: 'Platz',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: <?= json_encode($sdata['ranking']); ?>
|
||||
}
|
||||
]
|
||||
};
|
||||
<div class="col">
|
||||
<?= partial('graph.html.php', [
|
||||
'id' => 'graph3'.$dog,
|
||||
'title' => 'Platzierung',
|
||||
'xaxis' => $sdata['dates'],
|
||||
'seriesdata' => [
|
||||
['name' => 'Platzierung', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['ranking']],
|
||||
],
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// Display the chart using the configuration items and data just specified.
|
||||
myChart.setOption(option);
|
||||
</script>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<hr>
|
||||
|
Reference in New Issue
Block a user