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

262 lines
5.5 KiB
PHP
Raw 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')
2024-12-18 15:14:13 +01:00
@section('main')
2025-01-05 13:26:51 +01:00
<article class="header" style="grid-area: chart1;">
2024-12-18 15:14:13 +01:00
<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>
2025-01-05 13:26:51 +01:00
<button popovertarget="pop1">
<span>Erklärungen zum Diagramm</span>
</button>
<div popover id="pop1">
<p>Das Diagram zeigt...</p>
</div>
<div>
2024-12-18 15:14:13 +01:00
</header>
<div id="chart-props-per-region"></div>
</article>
2025-01-05 13:26:51 +01:00
<article class="header" style="grid-area: chart2;">
2024-12-18 15:14:13 +01:00
<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>
2025-01-05 13:26:51 +01:00
<article style="grid-area: chart4;">
2024-12-18 15:14:13 +01:00
<div id="leaflet"></div>
</article>
2025-01-05 13:26:51 +01:00
<article class="header" style="grid-area: chart3;">
2024-12-20 15:25:33 +01:00
<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
2025-01-03 16:25:30 +01:00
const sharedOptions = {
basic: {
color: ['#f1eef6','#bdc9e1','#74a9cf','#2b8cbe','#045a8d'],
grid: {
top: 20,
left: 60,
right: 0,
bottom: 50
},
name: (opt) => {
return {
name: opt.name,
nameLocation: opt.location,
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
},
}
}
2024-12-20 15:25:33 +01:00
}
}
2025-01-03 16:25:30 +01:00
const extractionDates = {!! json_encode($growth['dates']) !!};
2024-12-20 15:25:33 +01:00
const chartHeatmap = document.getElementById('chart-heatmap');
const cHeatmap = echarts.init(chartHeatmap);
const cHeatmapOptions = {
tooltip: {
position: 'top'
},
grid: {
2025-01-05 13:26:51 +01:00
top: 30,
2024-12-20 15:25:33 +01:00
right: 0,
bottom: 0,
left: 0
},
2025-01-05 13:26:51 +01:00
dataZoom: [{
type: 'inside'
}
],
2024-12-20 15:25:33 +01:00
xAxis: {
2025-01-05 13:26:51 +01:00
show: false,
2025-01-03 16:25:30 +01:00
name: 'Kurzzeitmietobjekt',
2024-12-20 15:25:33 +01:00
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
2025-01-03 16:25:30 +01:00
},
axisLabel: {
show: true,
2024-12-20 15:25:33 +01:00
}
},
yAxis: {
2025-01-05 13:26:51 +01:00
show: false,
2024-12-20 15:25:33 +01:00
type: 'category',
data: extractionDates,
splitArea: {
show: true
}
},
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-03 16:25:30 +01:00
name: 'Auslastung',
2024-12-20 15:25:33 +01:00
type: 'heatmap',
2025-01-05 13:26:51 +01:00
blurSize: 0,
2024-12-20 21:46:54 +01:00
data: {!! json_encode($heat['values']) !!},
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) => {
let v = data.value
return `Kurzzeitmietobjekte-ID: ${data.name}<br />Datum Scraping: ${extractionDates[v[1]]}<br/>Auslastung: ${v[2]} %`
},
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,
2024-12-18 15:14:13 +01:00
xAxis: {
2025-01-03 16:25:30 +01:00
name: 'Region',
nameLocation: 'center',
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
},
2024-12-18 15:14:13 +01:00
type: 'category',
data: {!! $propsPerRegion[0] !!}
},
yAxis: {
2025-01-03 16:25:30 +01:00
type: 'value',
name: 'Anzahl Kurzzeitmietobjekte',
nameLocation: 'middle',
nameGap: 38,
nameTextStyle: {
fontWeight: 'bold',
},
2024-12-18 15:14:13 +01:00
},
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
},
2025-01-03 16:25:30 +01:00
color: sharedOptions.basic.color,
grid: sharedOptions.basic.grid,
2024-12-18 15:14:13 +01:00
xAxis: {
2025-01-03 16:25:30 +01:00
name: 'Zeitpunkt Scraping',
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-03 16:25:30 +01:00
name: 'Anzahl Kurzzeitmietobjekte',
nameLocation: 'center',
nameGap: 38,
nameTextStyle: {
fontWeight: 'bold',
},
2024-12-18 15:14:13 +01:00
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