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
@@ -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
|
||||
Reference in new issue
Block a user