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

211 lines
4.2 KiB
PHP
Raw Normal View History

2024-12-18 15:14:13 +01:00
@extends('base')
@section('main')
<article class="header">
<header>
<h2>
2024-12-18 20:10:11 +01:00
Anzahl jemals gefundene Kurzzeitmietobjekte pro Region
2024-12-18 15:14:13 +01:00
</h2>
</header>
<div id="chart-props-per-region"></div>
</article>
<article class="header">
<header>
<h2>
2024-12-18 20:10:11 +01:00
Entwicklung der Anzahl jemals gefunden Kurzzeitmietobjekte
2024-12-18 15:14:13 +01:00
</h2>
</header>
<div id="extractions"></div>
</article>
<article>
<div id="leaflet"></div>
</article>
2024-12-20 15:25:33 +01:00
<article class="header">
<header>
<h2>
Gesamtauslastung
</h2>
</header>
<div id="chart-heatmap"></div>
</article>
2024-12-18 15:14:13 +01:00
<script type="module">
2024-12-20 15:25:33 +01:00
const hours = [
'12a', '1a', '2a', '3a', '4a', '5a', '6a',
'7a', '8a', '9a', '10a', '11a',
'12p', '1p', '2p', '3p', '4p', '5p',
'6p', '7p', '8p', '9p', '10p', '11p'
];
const extractionDates = {!! json_encode($growth['dates']) !!};
// prettier-ignore
let data = [];
for(let i = 0; i <= extractionDates.length; i++){
for(let j = 0; j <= hours.length; j++){
data.push([j,i,Math.random() * 3]);
}
}
const chartHeatmap = document.getElementById('chart-heatmap');
const cHeatmap = echarts.init(chartHeatmap);
const cHeatmapOptions = {
tooltip: {
position: 'top'
},
grid: {
top: 0,
right: 0,
bottom: 0,
left: 0
},
xAxis: {
type: 'category',
2024-12-20 21:46:54 +01:00
data: {!! json_encode($heat['property_ids']) !!},
2024-12-20 15:25:33 +01:00
splitArea: {
show: false
}
},
yAxis: {
type: 'category',
data: extractionDates,
splitArea: {
show: true
}
},
visualMap: {
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',
bottom: '15%'
},
series: [
{
name: 'Punch Card',
type: 'heatmap',
2024-12-20 21:46:54 +01:00
data: {!! json_encode($heat['values']) !!},
2024-12-20 15:25:33 +01:00
label: {
show: false
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
}
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 = {
grid: {
top: 20,
left: 30,
right: 0,
bottom: 20
},
xAxis: {
type: 'category',
data: {!! $propsPerRegion[0] !!}
},
yAxis: {
type: 'value'
},
series: [
{
data: {!! $propsPerRegion[1] !!},
type: 'bar'
}
]
};
cPropsPerRegion.setOption(cPropsPerRegionOptions);
const chartExtractions = document.getElementById('extractions');
const cExtractions = echarts.init(chartExtractions);
const filters = {
2024-12-18 19:52:06 +01:00
regions: ["Alle", "Davos", "Engadin", "Heidiland", "St. Moritz"]
2024-12-18 15:14:13 +01:00
}
const cExtractionsOptions = {
tooltip: {
trigger: 'axis'
},
legend: {
data: filters.regions
},
grid: {
left: '0',
right: 10,
bottom: '0',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
2024-12-20 15:25:33 +01:00
data: extractionDates
2024-12-18 15:14:13 +01:00
},
yAxis: {
type: 'value'
},
series: [
{
name: 'Alle',
type: 'line',
stack: 'Total',
2024-12-18 19:52:06 +01:00
data: {!! json_encode($growth['total_all']) !!}
2024-12-18 15:14:13 +01:00
},
{
name: 'Heidiland',
type: 'line',
stack: 'Heidiland',
2024-12-18 19:52:06 +01:00
data: {!! json_encode($growth['total_heidiland']) !!}
2024-12-18 15:14:13 +01:00
},
{
name: 'Davos',
type: 'line',
stack: 'Davos',
2024-12-18 19:52:06 +01:00
data: {!! json_encode($growth['total_davos']) !!}
2024-12-18 15:14:13 +01:00
},
{
name: 'Engadin',
type: 'line',
stack: 'Engadin',
2024-12-18 19:52:06 +01:00
data: {!! json_encode($growth['total_engadin']) !!}
2024-12-18 15:14:13 +01:00
},
{
name: 'St. Moritz',
type: 'line',
stack: 'St. Moritz',
2024-12-18 19:52:06 +01:00
data: {!! json_encode($growth['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').setView([46.862962, 9.535296], 9);
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);
const properties = {!! json_encode($geo) !!}
properties.forEach( prop => {
let coords = prop.coordinates.split(',');
L.marker(coords).addTo(map).bindPopup('<a href="/prop/'+prop.id+'">'+prop.coordinates+'</a>');
})
2024-12-18 15:14:13 +01:00
</script>
@endsection