diff --git a/dashboard/app/Api.php b/dashboard/app/Api.php index 5d0033e..02d714b 100644 --- a/dashboard/app/Api.php +++ b/dashboard/app/Api.php @@ -23,7 +23,7 @@ class Api return Cache::get($request); } - $get = Http::timeout(800)->get($request); + $get = Http::timeout(1600)->get($request); if($get->successful()){ $result = $get->json(); @@ -94,6 +94,11 @@ class Api return self::get("/region/{$id}/capacities"); } + public static function regionMovingAverage(int $id, string $date): mixed + { + return self::get("/region/{$id}/movingAverage/{$date}"); + } + } diff --git a/dashboard/resources/css/app.css b/dashboard/resources/css/app.css index dcec28e..390f76f 100644 --- a/dashboard/resources/css/app.css +++ b/dashboard/resources/css/app.css @@ -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; +} diff --git a/dashboard/resources/views/overview.blade.php b/dashboard/resources/views/overview.blade.php index 476288c..292f68b 100644 --- a/dashboard/resources/views/overview.blade.php +++ b/dashboard/resources/views/overview.blade.php @@ -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: '© OpenStreetMap' }).addTo(map); -const properties = {!! json_encode($geo) !!} -properties.forEach( prop => { - let coords = prop.coordinates.split(','); - L.marker(coords).addTo(map).bindPopup(''+prop.coordinates+''); +function icon(id){ + return L.divIcon({ + className: "region"+id, + html: '' + }) +} + +const markers = L.featureGroup([ + @foreach($geo as $g) + L.marker([{{ $g['latlng'] }}], {icon: icon({{ $g['region_id'] }})}).bindPopup('{{ $g['latlng'] }}'), + @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'); +}) + + @endsection diff --git a/dashboard/resources/views/property.blade.php b/dashboard/resources/views/property.blade.php index a33b7fb..da91f28 100644 --- a/dashboard/resources/views/property.blade.php +++ b/dashboard/resources/views/property.blade.php @@ -32,6 +32,14 @@
+