ConsultancyProject_2_ETL/dashboard/resources/views/overview.blade.php

366 lines
8.7 KiB
PHP
Raw Permalink Normal View History

2024-12-18 15:14:13 +01:00
@extends('base')
2025-01-05 13:26:51 +01:00
@section('body-class', 'overview')
2025-01-12 20:55:46 +01:00
@section('header')
<nav>
<strong>Start</strong>
<ul>
@foreach($regions as $r)
<li><a href="/region/{{ $r['id'] }}">{{ $r['name'] }}</a></li>
2025-01-12 20:55:46 +01:00
@endforeach
</ul>
</nav>
@endsection
2024-12-18 15:14:13 +01:00
@section('main')
2025-01-19 11:27:21 +01:00
<article class="header" style="grid-area: chart1;">
2025-01-15 16:57:18 +01:00
<header>
2025-01-17 19:09:16 +01:00
<h2>Verfügbarkeit aller Mietobjekte über gesamten beobachteten Zeitraum</h2>
2025-01-15 16:57:18 +01:00
<button popovertarget="pop1">
<span>Erklärungen zum Diagramm</span>
</button>
<div popover id="pop1">
2025-01-17 19:09:16 +01:00
<h2>Verfügbarkeit aller Mietobjekte über gesamten beobachteten Zeitraum</h2>
2025-01-15 16:57:18 +01:00
<p>
Das Diagramm zeigt die Verfügbarkeit aller Mietobjekte zu allen beobachteten Zeitpunkten.
2025-01-15 16:57:18 +01:00
</p>
<ul>
<li>X-Achse: Zeitpunkt Beobachtung.</li>
2025-01-15 16:57:18 +01:00
<li>Y-Achse: Mietobjekte.</li>
<li>Kategorien: 0% = Das Mietobjekt ist komplett Ausgebucht; 100% = Das Mietobjekt kann zu allen Verfügbaren Daten gebucht werden.</li>
</ul>
<h3>Berrechnung Verfügbarkeit</h3>
<p>Die Verfügbarkeit eines Mietobjekt errechnet sich folgendermassen:</p>
<p class="formula">
Verfügbarkeit = (100 / (Anzahl Buchungsdaten * 2)) * Summe Status
</p>
<ul>
<li>Status: Jeder verfügbare Kalendertag kann den Status «Nicht Verfügbar» (0), «Verfügbar (kein Anreisetag)» (1) oder «Verfügbar» (2) aufweisen.</li>
<li>Anzahl Buchungsdaten: Die Summe aller angebotenen Buchungsdaten mit zwei multipliziert (= Alle Buchungdaten haben den Status «Verfügbar»)</li>
2025-01-15 16:57:18 +01:00
</ul>
</div>
<div>
</header>
<div id="chart-heatmap"></div>
</article>
2025-01-19 11:27:21 +01:00
<article class="header" style="grid-area: chart2;">
2025-01-15 16:57:18 +01:00
<header>
<h2>
Anzahl jemals gefundene Kurzzeitmietobjekte pro Region
</h2>
<button popovertarget="pop2">
<span>Erklärungen zum Diagramm</span>
</button>
<div popover id="pop2">
<h2>Anzahl jemals gefundener Mietobjekte pro Region</h2>
2025-01-15 16:57:18 +01:00
<p>
Das Balkendiagramm zeigt die Anzahl jemals gefundener Mietobjekte pro Region.
2025-01-15 16:57:18 +01:00
</p>
<ul>
<li>X-Achse: Region</li>
<li>Y-Achse: Anzahl Mietobjekte</li>
2025-01-15 16:57:18 +01:00
</ul>
</div>
<div>
</header>
<div id="chart-props-per-region"></div>
2024-12-18 15:14:13 +01:00
</article>
2025-01-19 11:27:21 +01:00
<article class="header" style="grid-area: chart3;">
2025-01-15 16:57:18 +01:00
<header>
<h2>
Entwicklung der Anzahl jemals gefunden Kurzzeitmietobjekte
</h2>
<button popovertarget="pop3">
<span>Erklärungen zum Diagramm</span>
</button>
<div popover id="pop3">
<h2>Entwicklung Anzahl jemals gefundener Mietobjekte pro Region</h2>
2025-01-15 16:57:18 +01:00
<p>
Das Liniendiagramm zeigt die Entwicklung aller jemals gefundener Mietobjekte pro Region.
2025-01-15 16:57:18 +01:00
</p>
<ul>
<li>X-Achse: Zeitpunkt Beobachtung</li>
<li>Y-Achse: Anzahl Mietobjekte</li>
2025-01-15 16:57:18 +01:00
</ul>
</div>
<div>
</header>
<div id="extractions"></div>
2024-12-18 15:14:13 +01:00
</article>
2025-01-05 13:26:51 +01:00
<article style="grid-area: chart4;">
2025-01-15 16:57:18 +01:00
<div id="leaflet"></div>
2024-12-20 15:25:33 +01:00
</article>
2024-12-18 15:14:13 +01:00
<script type="module">
2025-01-03 16:25:30 +01:00
const sharedOptions = {
basic: {
color: {!! $diagramsOptions['shared']['colors'] !!},
2025-01-03 16:25:30 +01:00
grid: {
2025-01-15 16:57:18 +01:00
top: 30,
left: 70,
2025-01-03 16:25:30 +01:00
right: 0,
2025-01-15 16:57:18 +01:00
bottom: 45
2025-01-03 16:25:30 +01:00
},
name: (opt) => {
return {
name: opt.name,
nameLocation: opt.location,
2025-01-15 16:57:18 +01:00
nameGap: 50,
2025-01-03 16:25:30 +01:00
nameTextStyle: {
fontWeight: 'bold',
},
}
}
2024-12-20 15:25:33 +01:00
}
}
const extractionDates = {!! $diagramsOptions['shared']['extractionDates'] !!};
2024-12-20 15:25:33 +01:00
const chartHeatmap = document.getElementById('chart-heatmap');
const cHeatmap = echarts.init(chartHeatmap);
const cHeatmapOptions = {
2025-01-12 20:55:46 +01:00
animation: false,
2024-12-20 15:25:33 +01:00
tooltip: {
position: 'top'
},
grid: {
2025-01-17 13:02:54 +01:00
show: true,
borderWidth: 1,
borderColor: '#aaa',
2025-01-05 13:26:51 +01:00
top: 30,
2025-01-12 20:55:46 +01:00
right: 45,
2025-01-17 13:22:05 +01:00
bottom: 70,
left: 30
2024-12-20 15:25:33 +01:00
},
2025-01-05 13:26:51 +01:00
dataZoom: [{
2025-01-12 20:55:46 +01:00
type: 'slider'
},
{
type: 'slider',
show: true,
yAxisIndex: 0,
}],
2024-12-20 15:25:33 +01:00
xAxis: {
2025-01-17 13:22:05 +01:00
show: true,
name: 'Zeitpunkt Beobachtung',
2024-12-20 15:25:33 +01:00
type: 'category',
data: extractionDates,
2024-12-20 15:25:33 +01:00
splitArea: {
show: false
2025-01-03 16:25:30 +01:00
},
2025-01-17 13:22:05 +01:00
splitArea: {
show: false
},
2025-01-03 16:25:30 +01:00
axisLabel: {
2025-01-17 13:22:05 +01:00
show: false,
},
axisTick: {
show: false,
},
axisLine: {
show: false,
},
nameLocation: 'center',
nameGap: 10,
nameTextStyle: {
fontWeight: 'bold',
2024-12-20 15:25:33 +01:00
}
},
yAxis: {
2025-01-17 13:22:05 +01:00
show: true,
2024-12-20 15:25:33 +01:00
type: 'category',
data: {!! $diagramsOptions['heatmap']['yAxis']['data'] !!},
2024-12-20 15:25:33 +01:00
splitArea: {
2025-01-17 13:22:05 +01:00
show: false
},
axisTick: {
show: false,
},
axisLine: {
show: false,
},
axisLabel: {
show: false,
},
name: 'Mietobjekte',
nameLocation: 'center',
nameGap: 10,
nameTextStyle: {
fontWeight: 'bold',
2024-12-20 15:25:33 +01:00
}
},
visualMap: {
2025-01-03 16:25:30 +01:00
type: 'piecewise',
2024-12-20 15:25:33 +01:00
min: 0,
2024-12-20 21:46:54 +01:00
max: 100,
2024-12-20 15:25:33 +01:00
calculable: true,
orient: 'horizontal',
left: 'center',
2025-01-03 16:25:30 +01:00
top: 0,
2025-01-05 13:26:51 +01:00
formatter: (v1, v2) => {
return `${v1}${v2}%`;
},
2025-01-03 16:25:30 +01:00
inRange: {
2025-01-05 13:26:51 +01:00
color: sharedOptions.basic.color,
2025-01-03 16:25:30 +01:00
},
2024-12-20 15:25:33 +01:00
},
series: [
{
2025-01-17 19:09:16 +01:00
name: 'Verfügbarkeit',
2024-12-20 15:25:33 +01:00
type: 'heatmap',
2025-01-05 13:26:51 +01:00
blurSize: 0,
data: {!! $diagramsOptions['heatmap']['series']['data'] !!},
2024-12-20 15:25:33 +01:00
label: {
show: false
},
2025-01-03 16:25:30 +01:00
tooltip: {
2025-01-05 13:26:51 +01:00
formatter: (data) => {
return `Kurzzeitmietobjekte-ID: ${data.data[1]}<br />Beobachtungszeitpunkt: ${data.data[0]}<br/>Verfügbarkeit: ${data.data[2].toFixed(2)}%`
2025-01-05 13:26:51 +01:00
},
2025-01-03 16:25:30 +01:00
},
2024-12-20 15:25:33 +01:00
emphasis: {
itemStyle: {
2025-01-03 16:25:30 +01:00
borderColor: '#000',
borderWidth: 2
2024-12-20 15:25:33 +01:00
}
}
}
]
}
cHeatmap.setOption(cHeatmapOptions);
2024-12-18 15:14:13 +01:00
const chartPropsPerRegion = document.getElementById('chart-props-per-region');
const cPropsPerRegion = echarts.init(chartPropsPerRegion);
const cPropsPerRegionOptions = {
2025-01-03 16:25:30 +01:00
grid: sharedOptions.basic.grid,
color: sharedOptions.basic.color,
2024-12-18 15:14:13 +01:00
xAxis: {
2025-01-03 16:25:30 +01:00
name: 'Region',
nameLocation: 'center',
2025-01-15 16:57:18 +01:00
nameGap: 30,
2025-01-03 16:25:30 +01:00
nameTextStyle: {
fontWeight: 'bold',
},
2024-12-18 15:14:13 +01:00
type: 'category',
data: {!! $diagramsOptions['propertiesPerRegion']['xAxis']['data'] !!}
2024-12-18 15:14:13 +01:00
},
yAxis: {
2025-01-03 16:25:30 +01:00
type: 'value',
2025-01-15 16:57:18 +01:00
name: 'Anzahl Mietobjekte',
2025-01-03 16:25:30 +01:00
nameLocation: 'middle',
2025-01-15 16:57:18 +01:00
nameGap: 50,
2025-01-03 16:25:30 +01:00
nameTextStyle: {
fontWeight: 'bold',
},
2024-12-18 15:14:13 +01:00
},
series: [
{
data: {!! $diagramsOptions['propertiesPerRegion']['yAxis']['data'] !!},
type: 'bar',
itemStyle: {
color: (e) => {
return sharedOptions.basic.color[e.dataIndex];
}
}
},
2024-12-18 15:14:13 +01:00
]
};
cPropsPerRegion.setOption(cPropsPerRegionOptions);
const chartExtractions = document.getElementById('extractions');
const cExtractions = echarts.init(chartExtractions);
const cExtractionsOptions = {
color: sharedOptions.basic.color,
2024-12-18 15:14:13 +01:00
tooltip: {
trigger: 'axis'
},
legend: {
show: true
2024-12-18 15:14:13 +01:00
},
2025-01-03 16:25:30 +01:00
grid: sharedOptions.basic.grid,
2024-12-18 15:14:13 +01:00
xAxis: {
name: 'Zeitpunkt Beobachtung',
2025-01-03 16:25:30 +01:00
nameLocation: 'center',
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
},
2024-12-18 15:14:13 +01:00
type: 'category',
boundaryGap: false,
2024-12-20 15:25:33 +01:00
data: extractionDates
2024-12-18 15:14:13 +01:00
},
yAxis: {
2025-01-15 16:57:18 +01:00
name: 'Anzahl Mietobjekte',
2025-01-03 16:25:30 +01:00
nameLocation: 'center',
2025-01-15 16:57:18 +01:00
nameGap: 50,
2025-01-03 16:25:30 +01:00
nameTextStyle: {
fontWeight: 'bold',
},
2024-12-18 15:14:13 +01:00
type: 'value'
},
series: [
{
name: 'Alle',
type: 'line',
stack: 'Total',
data: {!! json_encode($diagramsOptions['extractions']['series']['total_all']) !!},
2024-12-18 15:14:13 +01:00
},
{
2025-01-17 15:25:03 +01:00
connectNulls: true,
2024-12-18 15:14:13 +01:00
name: 'Davos',
type: 'line',
data: {!! json_encode($diagramsOptions['extractions']['series']['total_davos']) !!}
2024-12-18 15:14:13 +01:00
},
{
2025-01-17 15:25:03 +01:00
connectNulls: true,
2024-12-18 15:14:13 +01:00
name: 'Engadin',
type: 'line',
data: {!! json_encode($diagramsOptions['extractions']['series']['total_engadin']) !!}
2024-12-18 15:14:13 +01:00
},
{
2025-01-17 15:25:03 +01:00
connectNulls: true,
name: 'Heidiland',
type: 'line',
data: {!! json_encode($diagramsOptions['extractions']['series']['total_heidiland']) !!}
},
2024-12-18 15:14:13 +01:00
{
2025-01-17 15:25:03 +01:00
connectNulls: true,
2024-12-18 15:14:13 +01:00
name: 'St. Moritz',
type: 'line',
data: {!! json_encode($diagramsOptions['extractions']['series']['total_stmoritz']) !!}
2024-12-18 15:14:13 +01:00
},
]
};
cExtractions.setOption(cExtractionsOptions);
2024-12-18 19:52:06 +01:00
const map = L.map('leaflet');
2024-12-18 19:52:06 +01:00
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
function icon(id){
return L.divIcon({
className: "region"+id,
html: '<span></span>'
})
}
const markers = L.featureGroup([
@foreach($geo as $g)
L.marker([{{ $g['latlng'] }}], {icon: icon({{ $g['region_id'] }})}).bindPopup('<a href="/property/{{ $g['property_id'] }}">{{ $g['latlng'] }}</a>'),
@endforeach
]).addTo(map);
map.fitBounds(markers.getBounds(), {padding: [20,20]})
cHeatmap.on('click', 'series', (e) => {
window.open(`/property/${e.value[1]}?date=${e.value[0]}`, '_self');
2024-12-18 19:52:06 +01:00
})
2024-12-18 15:14:13 +01:00
</script>
@endsection