Einige Anpassungen am Dashboard. Region Ansicht.
This commit is contained in:
1 parent
a3121bf58e
commit
ebcd647a2f
9 files changed
+306
-67
No files matched your search
@@ -178,10 +178,10 @@ body.property main{
|
||||
grid-template-columns: repeat(4, minmax(10%, 50%));
|
||||
grid-template-rows: repeat(3, 1fr) 4em;
|
||||
grid-template-areas:
|
||||
"chart2 chart2 chart5 chart5"
|
||||
"chart1 chart1 chart3 chart4"
|
||||
"chart1 chart1 chart3 chart4"
|
||||
"timeline timeline timeline timeline";
|
||||
"chart2 chart2 chart1 chart1"
|
||||
"chart5 chart5 chart1 chart1"
|
||||
"chart5 chart5 chart3 chart4"
|
||||
"chart5 chart5 timeline timeline";
|
||||
}
|
||||
|
||||
body.region main{
|
||||
@@ -190,8 +190,8 @@ body.region main{
|
||||
grid-template-areas:
|
||||
"chart1 chart1 chart2 chart2"
|
||||
"chart1 chart1 chart3 chart4"
|
||||
"chart1 chart1 chart3 chart4"
|
||||
"chart1 chart1 timeline timeline";
|
||||
"chart6 chart6 chart3 chart4"
|
||||
"chart6 chart6 timeline timeline";
|
||||
}
|
||||
|
||||
article{
|
||||
@@ -204,10 +204,18 @@ article{
|
||||
|
||||
article.header{
|
||||
grid-template-columns: 100%;
|
||||
grid-template-rows: minmax(1%, 10%) 1fr;
|
||||
grid-template-rows: minmax(1%, 2.5em) 1fr;
|
||||
padding: .5em 1em 1em .5em;
|
||||
}
|
||||
|
||||
article.map{
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
article.map>header{
|
||||
padding: .5em 1em 1em .5em;
|
||||
}
|
||||
|
||||
article>header{
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1em;
|
||||
@@ -231,3 +239,33 @@ article>header>h2{
|
||||
grid-template-rows: repeat(4, minmax(20em, 25em));
|
||||
}
|
||||
}
|
||||
|
||||
.leaflet-marker-icon span{
|
||||
background: blue;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
display: block;
|
||||
left: -1rem;
|
||||
top: -1rem;
|
||||
position: relative;
|
||||
border-radius: 50% 50% 0;
|
||||
transform: rotate(45deg);
|
||||
border: 2px solid #fff
|
||||
}
|
||||
|
||||
/*['#9ecae1','#6baed6','#4292c6','#2171b5','#084594'*/
|
||||
.leaflet-marker-icon.region1 span{
|
||||
background: #9ecae1;
|
||||
}
|
||||
|
||||
.leaflet-marker-icon.region2 span{
|
||||
background: #6baed6;
|
||||
}
|
||||
|
||||
.leaflet-marker-icon.region3 span{
|
||||
background: #4292c6;
|
||||
}
|
||||
|
||||
.leaflet-marker-icon.region4 span{
|
||||
background: #2171b5;
|
||||
}
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
const sharedOptions = {
|
||||
basic: {
|
||||
color: ['#f1eef6','#bdc9e1','#74a9cf','#2b8cbe','#045a8d'],
|
||||
color: ['#9ecae1','#6baed6','#4292c6','#2171b5','#08519c','#08306b'],
|
||||
grid: {
|
||||
top: 20,
|
||||
left: 60,
|
||||
@@ -156,6 +156,7 @@ const chartPropsPerRegion = document.getElementById('chart-props-per-region');
|
||||
const cPropsPerRegion = echarts.init(chartPropsPerRegion);
|
||||
const cPropsPerRegionOptions = {
|
||||
grid: sharedOptions.basic.grid,
|
||||
color: sharedOptions.basic.color,
|
||||
xAxis: {
|
||||
name: 'Region',
|
||||
nameLocation: 'center',
|
||||
@@ -178,8 +179,13 @@ const cPropsPerRegionOptions = {
|
||||
series: [
|
||||
{
|
||||
data: {!! $propsPerRegion[1] !!},
|
||||
type: 'bar'
|
||||
}
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
color: (e) => {
|
||||
return sharedOptions.basic.color[e.dataIndex];
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
@@ -193,13 +199,13 @@ const filters = {
|
||||
}
|
||||
|
||||
const cExtractionsOptions = {
|
||||
color: sharedOptions.basic.color,
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: filters.regions
|
||||
},
|
||||
color: sharedOptions.basic.color,
|
||||
grid: sharedOptions.basic.grid,
|
||||
xAxis: {
|
||||
name: 'Zeitpunkt Scraping',
|
||||
@@ -226,30 +232,26 @@ const cExtractionsOptions = {
|
||||
name: 'Alle',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: {!! json_encode($growth['total_all']) !!}
|
||||
},
|
||||
{
|
||||
name: 'Heidiland',
|
||||
type: 'line',
|
||||
stack: 'Heidiland',
|
||||
data: {!! json_encode($growth['total_heidiland']) !!}
|
||||
data: {!! json_encode($growth['total_all']) !!},
|
||||
},
|
||||
{
|
||||
name: 'Davos',
|
||||
type: 'line',
|
||||
stack: 'Davos',
|
||||
data: {!! json_encode($growth['total_davos']) !!}
|
||||
},
|
||||
{
|
||||
name: 'Engadin',
|
||||
type: 'line',
|
||||
stack: 'Engadin',
|
||||
data: {!! json_encode($growth['total_engadin']) !!}
|
||||
},
|
||||
{
|
||||
name: 'Heidiland',
|
||||
type: 'line',
|
||||
data: {!! json_encode($growth['total_heidiland']) !!}
|
||||
},
|
||||
{
|
||||
name: 'St. Moritz',
|
||||
type: 'line',
|
||||
stack: 'St. Moritz',
|
||||
data: {!! json_encode($growth['total_stmoritz']) !!}
|
||||
},
|
||||
]
|
||||
@@ -257,19 +259,38 @@ const cExtractionsOptions = {
|
||||
|
||||
cExtractions.setOption(cExtractionsOptions);
|
||||
|
||||
const map = L.map('leaflet').setView([46.862962, 9.535296], 9);
|
||||
const map = L.map('leaflet');
|
||||
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <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>');
|
||||
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');
|
||||
})
|
||||
|
||||
cPropsPerRegion.on('click', 'series', (e) => {
|
||||
console.log(e.dataIndex);
|
||||
//window.open(`/property/${e.value[1]}?date=${e.value[0]}`, '_self');
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
@@ -32,6 +32,14 @@
|
||||
</header>
|
||||
<div id="chart-calendar"></div>
|
||||
</article>
|
||||
<article class="header map" style="grid-area: chart5;">
|
||||
<header>
|
||||
<h2 id="belegung-title">
|
||||
Kurzzeitmietobjekte in der Nähe
|
||||
</h2>
|
||||
</header>
|
||||
<div id="chart-map"></div>
|
||||
</article>
|
||||
<article class="header" style="grid-area: chart3;">
|
||||
<header>
|
||||
<h2>
|
||||
@@ -80,7 +88,7 @@ const cTimelineOptions = {
|
||||
label: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
cTimeline.setOption(cTimelineOptions);
|
||||
@@ -168,6 +176,7 @@ const chartCapacity = document.getElementById('chart-capacity');
|
||||
const cCapacity = echarts.init(chartCapacity);
|
||||
|
||||
const cCapacityOptions = {
|
||||
color: ['#9ecae1','#6baed6','#4292c6','#2171b5','#084594'],
|
||||
legend: {
|
||||
data: ['Auslastung Property', 'Auslastung {{ $base['region_name'] }}', 'Auslastung alle Regionen']
|
||||
},
|
||||
@@ -176,7 +185,7 @@ const cCapacityOptions = {
|
||||
valueFormatter: (value) => value.toFixed(2)+' %'
|
||||
},
|
||||
grid: {
|
||||
top: 20,
|
||||
top: 40,
|
||||
left: 25,
|
||||
right: 10,
|
||||
bottom: 20,
|
||||
@@ -348,6 +357,29 @@ cTimeline.on('timelinechanged', (e) => {
|
||||
|
||||
})
|
||||
|
||||
/* Map w/ neighbours*/
|
||||
const map = L.map('chart-map');
|
||||
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
|
||||
function icon(id = 0){
|
||||
return L.divIcon({
|
||||
className: "region"+id,
|
||||
html: '<span></span>'
|
||||
})
|
||||
}
|
||||
|
||||
const markers = L.featureGroup([
|
||||
@foreach($neighbours as $n)
|
||||
L.marker([{{ $n['lat'] }}, {{ $n['lon'] }}], {icon: icon()}).bindPopup('<a href="/property/{{ $n['id'] }}">{{ $n['lat'] }}, {{ $n['lon'] }}</a>'),
|
||||
@endforeach
|
||||
]).addTo(map);
|
||||
|
||||
map.fitBounds(markers.getBounds(), {padding: [20,20]})
|
||||
|
||||
cCapacity.on('click', 'series', (e) => {
|
||||
|
||||
// Switch to correct calendar in the timeline
|
||||
@@ -356,7 +388,6 @@ cCapacity.on('click', 'series', (e) => {
|
||||
currentIndex: e.dataIndex
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -17,9 +17,15 @@
|
||||
<article style="grid-area: timeline;">
|
||||
<div id="timeline"></div>
|
||||
</article>
|
||||
<article class="header" style="grid-area: chart6;">
|
||||
<header>
|
||||
<h2 id="prediction-title">Auslastung Vorhersage</h2>
|
||||
</header>
|
||||
<div id="chart-prediction"></div>
|
||||
</article>
|
||||
<article class="header" style="grid-area: chart1;">
|
||||
<header>
|
||||
<h2 id="belegung-title"></h2>
|
||||
<h2 id="belegung-title">Gesamtauslastung</h2>
|
||||
</header>
|
||||
<div id="chart-heatmap"></div>
|
||||
</article>
|
||||
@@ -58,7 +64,7 @@
|
||||
|
||||
const sharedOptions = {
|
||||
basic: {
|
||||
color: ['#f1eef6','#bdc9e1','#74a9cf','#2b8cbe','#045a8d'],
|
||||
color: ['#9ecae1','#6baed6','#4292c6','#2171b5','#084594'],
|
||||
grid: {
|
||||
top: 20,
|
||||
left: 60,
|
||||
@@ -134,22 +140,90 @@ const cCapacityOptions = {
|
||||
|
||||
cCapacity.setOption(cCapacityOptions);
|
||||
|
||||
const chartPrediction = document.getElementById('chart-prediction');
|
||||
const cPrediction = echarts.init(chartPrediction);
|
||||
|
||||
const cPredictionOptions = {
|
||||
legend: {
|
||||
data: ['Moving Average', 'Earlier', 'Later']
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
valueFormatter: (value) => value.toFixed(2)+' %'
|
||||
},
|
||||
grid: {
|
||||
top: 20,
|
||||
left: 25,
|
||||
right: 10,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: {!! json_encode($prediction['dates']) !!},
|
||||
name: 'Zeitpunkt Scraping',
|
||||
nameLocation: 'center',
|
||||
nameGap: 24,
|
||||
nameTextStyle: {
|
||||
fontWeight: 'bold',
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
min: 0,
|
||||
max: 1,
|
||||
name: 'Auslastung in Prozent',
|
||||
nameLocation: 'center',
|
||||
nameGap: 38,
|
||||
nameTextStyle: {
|
||||
fontWeight: 'bold',
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: 'Moving Average',
|
||||
type: 'line',
|
||||
symbolSize: 7,
|
||||
data: {!! json_encode($prediction['movAvg']) !!}
|
||||
},
|
||||
{
|
||||
name: 'Earlier',
|
||||
type: 'line',
|
||||
symbolSize: 7,
|
||||
data: {!! json_encode($prediction['cap_earlierTimeframe']) !!}
|
||||
},
|
||||
{
|
||||
name: 'Later',
|
||||
type: 'line',
|
||||
symbolSize: 7,
|
||||
data: {!! json_encode($prediction['cap_laterTimeframe']) !!}
|
||||
}]
|
||||
};
|
||||
|
||||
cPrediction.setOption(cPredictionOptions);
|
||||
|
||||
|
||||
const chartHeatmap = document.getElementById('chart-heatmap');
|
||||
const cHeatmap = echarts.init(chartHeatmap);
|
||||
const cHeatmapOptions = {
|
||||
animation: false,
|
||||
tooltip: {
|
||||
position: 'top'
|
||||
},
|
||||
grid: {
|
||||
top: 30,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
right: 45,
|
||||
bottom: 50,
|
||||
left: 5
|
||||
},
|
||||
dataZoom: [{
|
||||
type: 'inside'
|
||||
}
|
||||
],
|
||||
type: 'slider'
|
||||
},
|
||||
{
|
||||
type: 'slider',
|
||||
show: true,
|
||||
yAxisIndex: 0,
|
||||
}],
|
||||
xAxis: {
|
||||
show: false,
|
||||
name: 'Kurzzeitmietobjekt',
|
||||
@@ -196,8 +270,7 @@ const cHeatmapOptions = {
|
||||
},
|
||||
tooltip: {
|
||||
formatter: (data) => {
|
||||
let v = data.value
|
||||
return `Kurzzeitmietobjekte-ID: ${data.name}<br />Datum Scraping: ${extractionDates[v[1]]}<br/>Auslastung: ${v[2]} %`
|
||||
return `Kurzzeitmietobjekte-ID: ${data.data[1]}<br />Datum Scraping: ${data.data[0]}<br/>Auslastung: ${data.data[2].toFixed(2)} %`
|
||||
},
|
||||
},
|
||||
emphasis: {
|
||||
|
||||
Reference in new issue
Block a user