Further dashboard development.

This commit is contained in:
Giò Diani committed 2024-12-18 19:52:06 +01:00
1 parent 1574edea88
commit a8543d619f
10 files changed
+209 -312

No files matched your search

+16 -1
View File
@@ -30,9 +30,24 @@ class Api
return self::get('/region/properties'); return self::get('/region/properties');
} }
public static function propertiesGrowth()
{
return self::get('/properties/growth');
}
public static function propertiesGeo()
{
return self::get('/properties/geo');
}
public static function propertyExtractions(int $id) public static function propertyExtractions(int $id)
{ {
return self::get("/properties/extractions/{$id}"); return self::get("/property/{$id}/extractions");
}
public static function propertyBase(int $id): mixed
{
return self::get("/property/{$id}/base");
} }
+12
View File
@@ -46,6 +46,14 @@ h1, h2, h3, h4, h5, h6 {
text-wrap: balance; text-wrap: balance;
} }
dt{
font-weight: 600;
}
dd + dt{
margin-top: .2em;
}
/* /*
9. Create a root stacking context 9. Create a root stacking context
*/ */
@@ -53,6 +61,10 @@ h1, h2, h3, h4, h5, h6 {
isolation: isolate; isolation: isolate;
} }
nav>ul{
list-style: none;
}
body>header{ body>header{
position: fixed; position: fixed;
-274
View File
@@ -2,277 +2,3 @@ import * as echarts from 'echarts';
import 'leaflet' import 'leaflet'
window.echarts = echarts; window.echarts = echarts;
/*
const chartPropsPerRegion = document.getElementById('chart-props-per-region');
const cPropsPerRegion = echarts.init(chartPropsPerRegion);
const cPropsPerRegionOptions = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar'
}
]
};
cPropsPerRegion.setOption(cPropsPerRegionOptions);
let properties = [[46.49593,9.83718],[46.48089,9.81599],[46.48824,9.83301],[46.497932,9.836767],[46.48615,9.83104],[46.4972399,9.8513866],[46.4867345,9.8349723],[46.4926593,9.8352605],[46.488409,9.840455],[46.5002929,9.8428447],[46.48024,9.81368],[46.48627,9.83095],[46.4904722,9.8346281],[46.48602,9.83109],[46.47736,9.81286],[46.4865553,9.8404283],[46.486563,9.8311711],[46.493988,9.836039],[46.4975,9.83937],[46.4852478,9.8316748],[46.488567,9.8424808],[46.4883782,9.8355532],[46.4868242,9.8332824],[46.49642,9.836712],[46.4883782,9.8355532],[46.47748,9.80948],[46.5002642,9.8429209],[46.4980738,9.8498749],[46.5034907,9.8465318],[46.4868242,9.8332824],[46.47927,9.81362],[46.4875089,9.8328176],[46.4884205,9.837406],[46.4861438,9.8311151],[46.49757,9.83946],[46.4933517,9.8352912],[46.4864667,9.8404068],[46.4866534,9.830708],[46.480585,9.815248],[46.4870555,9.8334099],[46.4786218,9.8127465],[46.48837,9.84037],[46.48604,9.83109],[46.4809238,9.8160696],[46.4898,9.83629],[46.48683,9.8333162],[46.4883782,9.8355532],[46.4771336,9.8134695],[46.4928286,9.8350188],[46.488891,9.841088],[46.499849,9.837025],[46.495869,9.837594],[46.47701,9.81146],[46.486404,9.8416679],[46.4783711,9.8132931],[46.49159,9.83546],[46.488303,9.840426],[46.4975017,9.8395553],[46.48672,9.83717],[46.4883753,9.8403742],[46.4883753,9.8403742],[46.4899857,9.8363568],[46.4863272,9.8405407],[46.497487,9.839477],[46.5020769,9.8418942],[46.50238,9.84558],[46.4884,9.84045],[46.48676,9.835],[46.4782248,9.8130534],[46.47749,9.80944],[46.48824,9.83301],[46.4869233,9.8376718],[46.4883782,9.8355532],[46.4882516,9.8402106],[46.49735,9.83945],[46.4883782,9.8355532],[46.48665,9.83723],[46.4883782,9.8355532],[46.49731,9.838838],[46.4883753,9.8403742],[46.4955609,9.8375856],[46.484052,9.8379806],[46.4883782,9.8355532],[46.496111,9.837175],[46.4843287,9.8376702],[46.4864902,9.8329028],[46.4895127,9.8359552],[46.503276,9.84604],[46.4852328,9.8323521],[46.4873273,9.8371615],[46.503511,9.846615],[46.48668,9.83719],[46.488172,9.833806],[46.4873397,9.831455],[46.4866534,9.830708],[46.495563,9.837539],[46.4984,9.84463],[46.4980738,9.8498749],[46.489777,9.8345806],[46.477581,9.810936],[46.4928286,9.8350188],[46.4974869,9.839558],[46.47591,9.8105111],[46.4887022,9.8352726],[46.4883233,9.8402706],[46.48668,9.83717],[46.47862,9.81366],[46.4891482,9.8343803],[46.4768608,9.813171],[46.477549,9.810314],[46.4895127,9.8359552],[46.498344,9.844374],[46.5032565,9.8460512],[46.4791522,9.8122151],[46.4985892,9.8401749],[46.48664,9.83696],[46.4859316,9.8307934],[46.48665,9.83723],[46.49876,9.837459],[46.4866,9.83716],[46.4885071,9.8411413],[46.4985324,9.8401342],[46.4849695,9.8320309],[46.4978506,9.8383183],[46.503635,9.846695],[46.5023548,9.8455593],[46.4865151,9.8403382],[46.48691,9.83212],[46.498764,9.8374597],[46.5003728,9.8424702],[46.498543,9.840123],[46.4987598,9.8374593],[46.487275,9.8323903],[46.5004613,9.8432744],[46.493155,9.835243],[46.4954953,9.8360637],[46.4890826,9.8354328],[46.4879702,9.8425062],[46.4974869,9.839558],[46.497987,9.8351241],[46.4768315,9.8132372],[46.503511,9.846615],[46.4891952,9.8354489],[46.489485,9.836001],[46.48838,9.83555],[46.4986225,9.8441318],[46.4886203,9.838023],[46.4883753,9.8403742],[46.496488,9.836766],[46.486678,9.837191],[46.476946,9.811528],[46.4786,9.81389],[46.4795257,9.8137264],[46.48089,9.81599],[46.498671,9.837675],[46.4883805,9.8355637],[46.4974869,9.839558],[46.4931507,9.8350282],[46.496111,9.837175],[46.4759,9.80941],[46.4809147,9.8159934],[46.477291,9.811467],[46.4763346,9.8103601],[46.48686,9.84097],[46.4909066,9.8347269],[46.502291,9.845428],[46.480674,9.814221],[46.484197,9.83739],[46.4918196,9.8345876],[46.4915284,9.8338491],[46.4974338,9.8350768],[46.48672,9.83717],[46.4867237,9.8371725],[46.48669,9.83724],[46.4939895,9.8359017],[46.5032761,9.84604],[46.498566,9.840089],[46.498344,9.844374],[46.4786235,9.8136651],[46.50028,9.84108],[46.4893186,9.8335381],[46.4873711,9.8325248],[46.4945882,9.835511],[46.475007,9.807983],[46.47591,9.8105111],[46.4971764,9.8369717],[46.4952387,9.8375284],[46.4940576,9.8369153],[46.4840021,9.8379366],[46.493951,9.835891],[46.5012405,9.8427173],[46.5388,9.87594],[46.60211,9.96407],[46.4946,9.90307],[46.55315,9.88566],[46.57833,9.92136],[46.55325,9.88494],[46.57227,9.93144],[46.6964,10.09554],[46.57807,9.92007],[46.4604,9.80592],[46.4329,9.76601],[46.50247,9.89315],[46.5144288,9.8599243],[46.60363,9.96082],[46.51445,9.85767],[46.57808,9.92007],[46.50533,9.89026],[46.57808,9.92007],[46.5785,9.91998],[46.6968,10.09621],[46.51028,9.85812],[46.57609,9.93219],[46.65407,10.0328],[46.55137,9.8876],[46.5759,9.93054],[46.41343,9.74001],[46.57322,9.93254],[46.51526,9.85821],[46.43307,9.76493],[46.53437,9.86964],[46.50093,9.8949],[46.60214,9.96407],[46.55337,9.89231],[46.49926,9.8962],[46.50068,9.8926],[46.50294,9.89265],[46.43313,9.7644],[46.55482,9.88683],[46.7947,10.24635],[46.69741,10.0937],[46.57324,9.93254],[46.57473,9.93214],[46.50247,9.89317],[46.42964,9.76165],[46.4989708,9.8966111],[46.53261,9.8685Line truncated
const chartDom = document.getElementById('extractions');
const myChart = echarts.init(chartDom);
const filters = {
regions: ["Davos", "Engadin", "Heidiland", "St. Moritz"]
}
const option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: filters.regions
},
grid: {
left: '0',
right: 10,
bottom: '0',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['2024-04-14','2024-04-15','2024-04-16','2024-04-19','2024-04-22','2024-04-25','2024-04-28','2024-05-01','2024-05-04','2024-05-07','2024-05-10','2024-05-13','2024-05-16','2024-05-19','2024-05-22','2024-05-25','2024-05-28','2024-05-31','2024-06-01','2024-06-04','2024-06-07','2024-06-10','2024-06-13','2024-06-16','2024-06-19','2024-06-22','2024-06-25','2024-06-28','2024-07-01','2024-07-04','2024-07-07','2024-07-10','2024-07-13','2024-07-16','2024-07-19','2024-07-22','2024-07-25','2024-07-28','2024-07-31','2024-08-01','2024-08-04','2024-08-07','2024-08-10','2024-08-13','2024-08-16','2024-08-19','2024-08-22']
},
yAxis: {
type: 'value'
},
series: [
{
name: 'Alle',
type: 'line',
stack: 'Total',
data: [596, 239, 835, 673, 863, 1803, 904, 915, 958, 966, 1001, 1031, 1044, 1055, 1158, 1162, 1181, 1203, 1207, 1214, 1254, 1258, 1264, 1288, 1296, 1305, 1318, 1323, 1330, 1333, 1342, 1350, 1436, 1454, 1461, 1469, 1492, 1504, 1506, 1510, 1512, 1518, 1534, 1535, 1541, 1544, 1500]
},
{
name: 'Heidiland',
type: 'line',
stack: 'Heidiland',
data: [133,64,197,151,197,417,210,213,215,220,226,239,247,251,251,252,262,275,276,277,281,283,284,286,287,287,287,287,287,287,287,289,290,292,293,294,294,294,295,295,295,296,312,313,313,313,301]
},
{
name: 'Davos',
type: 'line',
stack: 'Davos',
data: [133,56,189,152,196,409,206,209,209,209,221,223,223,224,226,227,230,234,236,238,250,252,252,259,261,263,267,270,272,272,274,274,277,278,279,281,286,289,289,289,289,290,290,290,293,296,285]
},
{
name: 'Engadin',
type: 'line',
stack: 'Engadin',
data: [185,73,258,212,278,569,284,289,326,326,340,346,350,355,413,413,413,413,414,415,438,438,442,455,460,463,470,472,477,479,484,486,544,554,558,561,578,585,586,590,592,595,595,595,597,597,583]
},
{
name: 'St. Moritz',
type: 'line',
stack: 'St. Moritz',
data: [145,46,191,158,192,408,204,204,208,211,214,223,224,225,268,270,276,281,281,284,285,285,286,288,288,292,294,294,294,295,297,301,325,330,331,333,334,336,336,336,336,337,337,337,338,338,331]
},
]
};
option && myChart.setOption(option);
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);
properties.forEach( prop => {
L.marker(prop).addTo(map);
})
function getVirtualData(year) {
const date = +echarts.time.parse(year + '-01-01');
const end = +echarts.time.parse(+year + 1 + '-01-01');
const dayTime = 3600 * 24 * 1000;
const data = [];
for (let time = date; time < end; time += dayTime) {
data.push([
echarts.time.format(time, '{yyyy}-{MM}-{dd}', false),
Math.floor(Math.random() * 10000)
]);
}
return data;
}
const sharedData = {
extractionDates: ['2024-04-14','2024-04-15','2024-04-16','2024-04-19','2024-04-22','2024-04-25','2024-04-28','2024-05-01','2024-05-04','2024-05-07','2024-05-10','2024-05-13','2024-05-16','2024-05-19','2024-05-22','2024-05-25','2024-05-28','2024-05-31','2024-06-01','2024-06-04','2024-06-07','2024-06-10','2024-06-13','2024-06-16','2024-06-19','2024-06-22','2024-06-25','2024-06-28','2024-07-01','2024-07-04','2024-07-07','2024-07-10','2024-07-13','2024-07-16','2024-07-19','2024-07-22','2024-07-25','2024-07-28','2024-07-31','2024-08-01','2024-08-04','2024-08-07','2024-08-10','2024-08-13','2024-08-16','2024-08-19','2024-08-22']
}
async function getCalData(ext_date){
return new Promise((res, rej) => {
fetch(`/calendar/${ext_date}.json`)
.then(r => r.json())
.then(json => {
let data = []
for (const [key, val] of Object.entries(json[0])){
data.push([key, val])
}
res(data)
})
})
}
let test = [["2024-09-08",204],["2025-06-05",105],["2024-12-15",175],["2025-09-11",103],["2025-06-30",104],["2024-10-15",201],["2024-09-13",204],["2025-10-15",82],["2024-08-09",143],["2025-01-10",145],["2024-11-13",212],["2025-02-21",88],["2024-11-26",187],["2024-10-22",221],["2024-11-14",214],["2025-02-14",92],["2024-05-27",175],["2024-09-11",206],["2025-04-28",107],["2024-08-03",139],["2025-05-25",105],["2025-10-10",92],["2025-10-26",70],["2025-03-06",109],["2024-12-14",181],["2025-01-05",147],["2024-06-19",167],["2024-06-28",174],["2024-08-10",162],["2025-06-14",107],["2025-10-03",92],["2024-12-22",126],["2025-04-23",107],["2025-05-11",105],["2025-08-23",103],["2024-07-16",149],["2025-08-05",103],["2024-04-25",171],["2025-01-23",148],["2024-10-06",197],["2025-02-16",95],["2024-12-23",116],["2025-03-13",142],["2025-09-01",96],["2024-12-16",179],["2024-08-22",160],["2024-09-28",228],["2024-10-25",220],["2025-08-03",104],["2024-05-25",189],["2024-08-20",158],["2024-08-24",170],["2024-07-12",166],["2024-11-08",220],["2025-03-01",130],["2025-07-13",104],["2024-06-11",181],["2024-08-01",91],["2025-05-29",105],["2025-07-19",107],["2025-10-13",92],["2024-08-07",140],["2024-11-15",216],["2025-04-03",140],["2024-09-20",205],["2025-03-14",144],["2025-06-24",105],["2025-01-19",154],["2024-05-20",171],["2024-08-21",161],["2025-10-23",73],["2024-07-30",108],["2024-11-03",215],["2025-01-04",143],["2025-04-12",111],["2025-08-14",103],["2025-07-05",107],["2025-06-17",105],["2024-06-13",187],["2024-11-12",213],["2025-03-07",110],["2024-04-23",175],["2025-07-06",104],["2025-10-12",92],["2024-12-19",176],["2024-07-18",145],["2024-08-13",145],["2024-07-08",167],["2025-02-11",88],["2024-07-25",150],["2025-02-18",88],["2024-06-27",178],["2024-10-05",212],["2024-05-18",162],["2025-09-05",103],["2025-10-17",72],["2024-07-05",158],["2024-11-20",210],["2024-10-28",215],["2024-05-07",159],["2025-02-27",121],["2025-06-02",105],["2025-04-10",136],["2024-11-25",188],["2024-12-12",174],["2024-11-28",188],["2025-07-12",107],["2025-08-25",95],["2025-10-16",72],["2024-12-25",93],["2024-12-27",94],["2025-09-18",103],["2025-08-16",107],["2024-05-14",169],["2024-06-23",168],["2025-07-08",103],["2025-06-07",107],["2024-05-30",158],["2025-03-26",140],["2025-10-25",75],["2025-05-28",105],["2025-03-08",149],["2024-05-05",158],["2025-04-18",107],["2025-07-22",103],["2024-06-18",165],["2024-11-01",216],["2024-11-02",227],["2025-04-01",142],["2024-04-30",154],["2024-05-26",181],["2025-08-19",102],["2024-09-03",198],["2025-05-08",105],["2025-01-24",144],["2024-08-15",142],["2025-03-27",143],["2024-07-24",147],["2024-12-10",175],["2024-05-19",152],["2024-12-24",96],["2025-03-29",154],["2025-06-23",105],["2025-09-26",95],["2024-09-04",201],["2024-09-09",209],["2024-04-28",159],["2024-05-10",137],["2024-08-18",155],["2024-11-21",212],["2024-09-01",206],["2024-07-22",149],["2025-01-09",146],["2025-01-28",99],["2024-09-02",203],["2025-02-23",121],["2025-05-23",105],["2025-10-29",67],["2024-06-03",180],["2025-04-21",107],["2025-09-17",103],["2025-08-18",103],["2025-05-02",101],["2025-10-04",95],["2024-07-20",168],["2024-11-24",192],["2024-06-10",179],["2025-01-21",146],["2024-09-22",219],["2025-02-15",112],["2024-10-14",201],["2025-05-22",105],["2025-06-21",107],["2025-07-17",103],["2024-12-21",161],["2024-12-29",66],["2024-12-11",172],["2024-07-14",159],["2024-08-17",162],["2024-10-01",197],["2025-01-31",106],["2025-04-26",111],["2024-12-28",88],["2024-08-27",173],["2025-03-16",150],["2025-01-27",103],["2025-06-01",105],["2024-04-14",65],["2024-12-26",99],["2025-04-16",107],["2025-08-02",107],["2025-03-30",147],["2025-08-31",87],["2024-09-29",213],["2025-03-28",143],["2024-12-07",189],["2025-10-28",67],["2024-09-10",207],["2025-03-25",144],["2024-11-10",221],["2025-05-27",105],["2025-08-15",104],["2025-10-24",73],["2024-10-27",222],["2024-04-16",74],["2024-12-02",179],["2025-01-13",159],["2025-05-16",105],["2024-09-21",223],["2025-09-24",99],["2025-07-30",103],["2024-11-07",218],["2025-07-31",103],["2025-03-10",143],["2025-07-29",103],["2025-09-22",103],["2024-08-30",181],["2024-10-12",223],["2025-03-05",105],["2025-02-20",89],["2024-05-08",160],["2025-04-19",111],["2024-10-13",205],["2025-06-15",105],["2025-10-20",73],["2024-08-02",88],["2025-10-31",67],["2024-07-01",171],["2025-08-17",105],["2025-03-02",114],["2024-09-26",213],["2024-07-28",139],["2025-02-06",93],["2024-07-07",172],["2025-06-22",105],["2024-10-18",204],["2025-01-22",145],["2025-07-02",104],["2024-08-29",176],["2025-06-08",105],["2024-05-13",171],["2025-09-07",103],["2025-10-18",75],["2025-02-22",129],["2024-06-21",162],["2025-04-07",141],["2025-09-04",100],["2024-05-21",178],["2024-07-21",154],["2024-12-01",180],["2024-04-29",163],["2025-05-20",105],["2025-02-04",90],["2025-06-28",107],["2025-09-16",103],["2025-01-07",143],["2025-06-03",105],["2024-12-06",178],["2024-10-21",221],["2024-04-20",188],["2025-06-06",105],["2025-07-09",103],["2025-01-18",165],["2025-05-30",105],["2025-02-01Line truncated
let test2 = [["2024-09-08",92],["2025-06-05",32],["2024-12-15",80],["2025-09-11",30],["2025-06-30",33],["2024-10-15",92],["2024-09-13",99],["2025-10-15",30],["2024-08-09",71],["2025-01-10",51],["2024-11-13",99],["2025-02-21",43],["2024-11-26",87],["2024-10-22",98],["2024-11-14",100],["2025-02-14",35],["2024-05-27",86],["2024-09-11",96],["2025-04-28",34],["2024-08-03",73],["2025-05-25",34],["2025-10-10",28],["2025-10-26",26],["2025-03-06",47],["2024-12-14",87],["2025-01-05",56],["2024-06-19",84],["2024-06-28",84],["2024-08-10",80],["2025-06-14",32],["2025-10-03",28],["2024-12-22",67],["2025-04-23",34],["2025-05-11",34],["2025-08-23",32],["2024-07-16",71],["2025-08-05",33],["2024-04-25",81],["2025-01-23",47],["2024-10-06",91],["2025-02-16",44],["2024-12-23",66],["2025-03-13",49],["2025-09-01",28],["2024-12-16",83],["2024-08-22",86],["2024-09-28",102],["2024-10-25",98],["2025-08-03",33],["2024-05-25",82],["2024-08-20",83],["2024-08-24",101],["2024-07-12",75],["2024-11-08",98],["2025-03-01",54],["2025-07-13",29],["2024-06-11",73],["2024-08-01",44],["2025-05-29",31],["2025-07-19",31],["2025-10-13",28],["2024-08-07",74],["2024-11-15",100],["2025-04-03",55],["2024-09-20",102],["2025-03-14",50],["2025-06-24",34],["2025-01-19",49],["2024-05-20",76],["2024-08-21",88],["2025-10-23",26],["2024-07-30",63],["2024-11-03",95],["2025-01-04",62],["2025-04-12",32],["2025-08-14",31],["2025-07-05",32],["2025-06-17",32],["2024-06-13",76],["2024-11-12",99],["2025-03-07",47],["2024-04-23",84],["2025-07-06",30],["2025-10-12",28],["2024-12-19",80],["2024-07-18",75],["2024-08-13",80],["2024-07-08",82],["2025-02-11",35],["2024-07-25",79],["2025-02-18",43],["2024-06-27",80],["2024-10-05",99],["2024-05-18",82],["2025-09-05",29],["2025-10-17",26],["2024-07-05",84],["2024-11-20",99],["2024-10-28",102],["2024-05-07",82],["2025-02-27",50],["2025-06-02",32],["2025-04-10",53],["2024-11-25",87],["2024-12-12",81],["2024-11-28",87],["2025-07-12",30],["2025-08-25",30],["2025-10-16",28],["2024-12-25",60],["2024-12-27",52],["2025-09-18",32],["2025-08-16",34],["2024-05-14",79],["2024-06-23",80],["2025-07-08",30],["2025-06-07",32],["2024-05-30",75],["2025-03-26",57],["2025-10-25",26],["2025-05-28",32],["2025-03-08",53],["2024-05-05",87],["2025-04-18",34],["2025-07-22",31],["2024-06-18",83],["2024-11-01",102],["2024-11-02",104],["2025-04-01",56],["2024-04-30",82],["2024-05-26",78],["2025-08-19",32],["2024-09-03",94],["2025-05-08",34],["2025-01-24",47],["2024-08-15",77],["2025-03-27",58],["2024-07-24",80],["2024-12-10",83],["2024-05-19",75],["2024-12-24",63],["2025-03-29",65],["2025-06-23",34],["2025-09-26",30],["2024-09-04",91],["2024-09-09",94],["2024-04-28",83],["2024-05-10",69],["2024-08-18",85],["2024-11-21",100],["2024-09-01",91],["2024-07-22",80],["2025-01-09",52],["2025-01-28",38],["2024-09-02",96],["2025-02-23",51],["2025-05-23",34],["2025-10-29",26],["2024-06-03",73],["2025-04-21",34],["2025-09-17",32],["2025-08-18",32],["2025-05-02",32],["2025-10-04",28],["2024-07-20",90],["2024-11-24",89],["2024-06-10",76],["2025-01-21",47],["2024-09-22",102],["2025-02-15",53],["2024-10-14",91],["2025-05-22",34],["2025-06-21",34],["2025-07-17",29],["2024-12-21",77],["2024-12-29",46],["2024-12-11",82],["2024-07-14",74],["2024-08-17",86],["2024-10-01",91],["2025-01-31",39],["2025-04-26",34],["2024-12-28",52],["2024-08-27",95],["2025-03-16",58],["2025-01-27",37],["2025-06-01",30],["2025-08-02",32],["2024-12-26",56],["2025-04-16",34],["2025-08-31",26],["2025-03-30",57],["2024-09-29",93],["2025-03-28",59],["2024-12-07",87],["2025-10-28",26],["2024-09-10",93],["2025-03-25",57],["2024-11-10",99],["2025-05-27",32],["2025-08-15",31],["2025-10-24",26],["2024-10-27",98],["2024-04-16",47],["2024-12-02",88],["2025-01-13",52],["2025-05-16",34],["2024-09-21",110],["2025-09-24",31],["2025-07-30",31],["2024-11-07",98],["2025-07-31",31],["2025-03-10",49],["2025-07-29",31],["2025-09-22",32],["2024-08-30",97],["2024-10-12",102],["2025-03-05",46],["2025-02-20",43],["2024-05-08",80],["2025-04-19",34],["2024-10-13",92],["2025-06-15",32],["2025-10-20",26],["2024-08-02",45],["2025-10-31",26],["2024-07-01",89],["2025-08-17",32],["2025-03-02",49],["2024-09-26",102],["2024-07-28",73],["2025-02-06",33],["2024-07-07",85],["2025-06-22",33],["2024-10-18",91],["2025-01-22",46],["2025-07-02",33],["2024-08-29",98],["2025-06-08",32],["2024-05-13",79],["2025-09-07",30],["2025-10-18",26],["2025-02-22",54],["2024-06-21",87],["2025-04-07",53],["2025-09-04",28],["2024-05-21",82],["2024-07-21",77],["2024-12-01",87],["2024-04-29",82],["2025-05-20",34],["2025-02-04",33],["2025-06-28",34],["2025-09-16",32],["2025-01-07",52],["2025-06-03",32],["2024-12-06",86],["2024-10-21",100],["2024-04-20",92],["2025-06-06",32],["2025-07-09",30],["2025-01-18",57],["2025-05-30",30],["2025-02-01",46],["2025-02-28",50],["2025-09-08",30],["2025-10-07",28],["2025-05-19",34],["2024-08-23",85],["2024-07-17",75],["2025-04-14",34],["2025-06-04",32],["2025-09-19",32],["2025-10-09",28],["2024-04-26",76],["2024-06-17",85],["20Line truncated
let test3 = [["2024-09-08",296],["2025-06-05",137],["2024-12-15",255],["2025-09-11",133],["2025-06-30",137],["2024-10-15",293],["2024-09-13",303],["2025-10-15",120],["2024-08-09",214],["2025-01-10",196],["2024-11-13",311],["2025-02-21",131],["2024-11-26",274],["2024-10-22",319],["2024-11-14",314],["2025-02-14",127],["2024-05-27",257],["2024-09-11",302],["2025-04-28",141],["2024-08-03",212],["2025-05-25",139],["2025-10-10",120],["2025-10-26",96],["2025-03-06",156],["2024-12-14",268],["2025-01-05",202],["2024-06-19",251],["2024-06-28",258],["2024-08-10",242],["2025-06-14",139],["2025-10-03",120],["2024-12-22",193],["2025-04-23",141],["2025-05-11",139],["2025-08-23",135],["2024-07-16",219],["2025-08-05",136],["2024-04-25",252],["2025-01-23",195],["2024-10-06",288],["2025-02-16",139],["2024-12-23",182],["2025-03-13",191],["2025-09-01",124],["2024-12-16",262],["2024-08-22",246],["2024-09-28",330],["2024-10-25",318],["2025-08-03",137],["2024-05-25",270],["2024-08-20",241],["2024-08-24",271],["2024-07-12",241],["2024-11-08",318],["2025-03-01",184],["2025-07-13",133],["2024-06-11",254],["2024-08-01",133],["2025-05-29",136],["2025-07-19",138],["2025-10-13",120],["2024-08-07",214],["2024-11-15",316],["2025-04-03",195],["2024-09-20",307],["2025-03-14",194],["2025-06-24",139],["2025-01-19",203],["2024-05-20",247],["2024-08-21",249],["2025-10-23",99],["2024-07-30",169],["2024-11-03",310],["2025-01-04",205],["2025-04-12",143],["2025-08-14",134],["2025-07-05",139],["2025-06-17",137],["2024-06-13",263],["2024-11-12",312],["2025-03-07",157],["2024-04-23",259],["2025-07-06",134],["2025-10-12",120],["2024-12-19",256],["2024-07-18",218],["2024-08-13",225],["2024-07-08",249],["2025-02-11",123],["2024-07-25",228],["2025-02-18",131],["2024-06-27",258],["2024-10-05",311],["2024-05-18",244],["2025-09-05",132],["2025-10-17",107],["2024-07-05",242],["2024-11-20",309],["2024-10-28",317],["2024-05-07",241],["2025-02-27",171],["2025-06-02",137],["2025-04-10",189],["2024-11-25",275],["2024-12-12",255],["2024-11-28",275],["2025-07-12",137],["2025-08-25",125],["2025-10-16",119],["2024-12-25",153],["2024-12-27",146],["2025-09-18",135],["2025-08-16",141],["2024-05-14",248],["2024-06-23",250],["2025-07-08",133],["2025-06-07",139],["2024-05-30",225],["2025-03-26",197],["2025-10-25",101],["2025-05-28",137],["2025-03-08",202],["2024-05-05",245],["2025-04-18",141],["2025-07-22",134],["2024-06-18",244],["2024-11-01",318],["2024-11-02",331],["2025-04-01",198],["2024-04-30",234],["2024-05-26",257],["2025-08-19",134],["2024-09-03",292],["2025-05-08",139],["2025-01-24",191],["2024-08-15",219],["2025-03-27",201],["2024-07-24",227],["2024-12-10",258],["2024-05-19",227],["2024-12-24",159],["2025-03-29",219],["2025-06-23",139],["2025-09-26",125],["2024-09-04",292],["2024-09-09",303],["2024-04-28",242],["2024-05-10",206],["2024-08-18",240],["2024-11-21",312],["2024-09-01",297],["2024-07-22",229],["2025-01-09",196],["2025-01-28",137],["2024-09-02",299],["2025-02-23",172],["2025-05-23",139],["2025-10-29",93],["2024-06-03",251],["2025-04-21",141],["2025-09-17",135],["2025-08-18",135],["2025-05-02",133],["2025-10-04",123],["2024-07-20",258],["2024-11-24",281],["2024-06-10",255],["2025-01-21",193],["2024-09-22",321],["2025-02-15",165],["2024-10-14",292],["2025-05-22",139],["2025-06-21",141],["2025-07-17",132],["2024-12-21",238],["2024-12-29",112],["2024-12-11",254],["2024-07-14",233],["2024-08-17",248],["2024-10-01",288],["2025-01-31",145],["2025-04-26",145],["2024-12-28",140],["2024-08-27",268],["2025-03-16",208],["2025-01-27",140],["2025-06-01",135],["2025-08-02",139],["2024-12-26",155],["2025-04-16",141],["2025-08-31",113],["2025-03-30",204],["2024-09-29",306],["2025-03-28",202],["2024-12-07",276],["2025-10-28",93],["2024-09-10",300],["2025-03-25",201],["2024-11-10",320],["2025-05-27",137],["2025-08-15",135],["2025-10-24",99],["2024-10-27",320],["2024-04-16",119],["2024-12-02",267],["2025-01-13",211],["2025-05-16",139],["2024-09-21",333],["2025-09-24",135],["2025-07-30",134],["2024-11-07",316],["2025-07-31",134],["2025-03-10",192],["2025-07-29",134],["2025-09-22",135],["2024-08-30",278],["2024-10-12",325],["2025-03-05",151],["2025-02-20",132],["2024-05-08",240],["2025-04-19",145],["2024-10-13",297],["2025-06-15",137],["2025-10-20",99],["2024-08-02",131],["2025-10-31",93],["2024-07-01",258],["2025-08-17",137],["2025-03-02",163],["2024-09-26",315],["2024-07-28",211],["2025-02-06",126],["2024-07-07",257],["2025-06-22",138],["2024-10-18",295],["2025-01-22",191],["2025-07-02",137],["2024-08-29",274],["2025-06-08",137],["2024-05-13",250],["2025-09-07",133],["2025-10-18",101],["2025-02-22",183],["2024-06-21",250],["2025-04-07",194],["2025-09-04",128],["2024-05-21",260],["2024-07-21",231],["2024-12-01",267],["2024-04-29",244],["2025-05-20",139],["2025-02-04",123],["2025-06-28",141],["2025-09-16",135],["2025-01-07",193],["2025-06-03",137],["2024-12-06",264],["2024-10-21",321],["2024-04-20",280],["2025-06-06",137],["2025-07-09",133],["2025-01-18",222],["2025-05-30",1Line truncated
const calOptData = new Promise((res, rej) => {
let calOptions = []
let i = 0;
sharedData.extractionDates.forEach(el => {
const daten = getCalData(el).then((result) => {
calOptions.push({
title: {
text: `Auslastung am ${el}`
},
series: [{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 0,
data: test
},
{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 1,
data: test
}]
})
i++;
});
res(calOptions)
})
})
calOptData.then((data) => {
const chartCapacity = document.getElementById('capacity');
const cCapacity = echarts.init(chartCapacity);
const cCapacityOptions = {
timeline: {
data: sharedData.extractionDates
},
tooltip: {},
visualMap: {
min: 0,
max: 500,
type: 'piecewise',
orient: 'horizontal',
left: 'center',
top: 0
},
calendar:[
{
orient: 'horizontal',
range: '2024',
top: 50,
right: 0,
left: 50,
bottom: "55%"
},
{
orient: 'horizontal',
range: '2025',
right: 100,
left: 50,
bottom: 60,
top: '55%'
},
],
options: [{
series: [{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 0,
data: test
},
{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 1,
data: test
}]
},
{
title: {
text: `Auslastung am `
},
series: [{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 0,
data: test2
},
{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 1,
data: test2
}]
},
{
title: {
text: `Auslastung am `
},
series: [{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 0,
data: test3
},
{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 1,
data: test3
}]
}]
};
cCapacity.setOption(cCapacityOptions);
})
*/
+7
View File
@@ -10,6 +10,13 @@
<body> <body>
<header> <header>
<span>Dashboard</span> <span>Dashboard</span>
<nav>
<ul>
<li>
<a href="/">Start</a>
</li>
</ul>
</nav>
</header> </header>
<main> <main>
@yield('main') @yield('main')
+23 -7
View File
@@ -60,7 +60,7 @@ const chartExtractions = document.getElementById('extractions');
const cExtractions = echarts.init(chartExtractions); const cExtractions = echarts.init(chartExtractions);
const filters = { const filters = {
regions: ["Davos", "Engadin", "Heidiland", "St. Moritz"] regions: ["Alle", "Davos", "Engadin", "Heidiland", "St. Moritz"]
} }
const cExtractionsOptions = { const cExtractionsOptions = {
@@ -79,7 +79,7 @@ const cExtractionsOptions = {
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: ['2024-04-14','2024-04-15','2024-04-16','2024-04-19','2024-04-22','2024-04-25','2024-04-28','2024-05-01','2024-05-04','2024-05-07','2024-05-10','2024-05-13','2024-05-16','2024-05-19','2024-05-22','2024-05-25','2024-05-28','2024-05-31','2024-06-01','2024-06-04','2024-06-07','2024-06-10','2024-06-13','2024-06-16','2024-06-19','2024-06-22','2024-06-25','2024-06-28','2024-07-01','2024-07-04','2024-07-07','2024-07-10','2024-07-13','2024-07-16','2024-07-19','2024-07-22','2024-07-25','2024-07-28','2024-07-31','2024-08-01','2024-08-04','2024-08-07','2024-08-10','2024-08-13','2024-08-16','2024-08-19','2024-08-22'] data: {!! json_encode($growth['dates']) !!}
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@@ -89,35 +89,51 @@ const cExtractionsOptions = {
name: 'Alle', name: 'Alle',
type: 'line', type: 'line',
stack: 'Total', stack: 'Total',
data: [596, 239, 835, 673, 863, 1803, 904, 915, 958, 966, 1001, 1031, 1044, 1055, 1158, 1162, 1181, 1203, 1207, 1214, 1254, 1258, 1264, 1288, 1296, 1305, 1318, 1323, 1330, 1333, 1342, 1350, 1436, 1454, 1461, 1469, 1492, 1504, 1506, 1510, 1512, 1518, 1534, 1535, 1541, 1544, 1500] data: {!! json_encode($growth['total_all']) !!}
}, },
{ {
name: 'Heidiland', name: 'Heidiland',
type: 'line', type: 'line',
stack: 'Heidiland', stack: 'Heidiland',
data: [133,64,197,151,197,417,210,213,215,220,226,239,247,251,251,252,262,275,276,277,281,283,284,286,287,287,287,287,287,287,287,289,290,292,293,294,294,294,295,295,295,296,312,313,313,313,301] data: {!! json_encode($growth['total_heidiland']) !!}
}, },
{ {
name: 'Davos', name: 'Davos',
type: 'line', type: 'line',
stack: 'Davos', stack: 'Davos',
data: [133,56,189,152,196,409,206,209,209,209,221,223,223,224,226,227,230,234,236,238,250,252,252,259,261,263,267,270,272,272,274,274,277,278,279,281,286,289,289,289,289,290,290,290,293,296,285] data: {!! json_encode($growth['total_davos']) !!}
}, },
{ {
name: 'Engadin', name: 'Engadin',
type: 'line', type: 'line',
stack: 'Engadin', stack: 'Engadin',
data: [185,73,258,212,278,569,284,289,326,326,340,346,350,355,413,413,413,413,414,415,438,438,442,455,460,463,470,472,477,479,484,486,544,554,558,561,578,585,586,590,592,595,595,595,597,597,583] data: {!! json_encode($growth['total_engadin']) !!}
}, },
{ {
name: 'St. Moritz', name: 'St. Moritz',
type: 'line', type: 'line',
stack: 'St. Moritz', stack: 'St. Moritz',
data: [145,46,191,158,192,408,204,204,208,211,214,223,224,225,268,270,276,281,281,284,285,285,286,288,288,292,294,294,294,295,297,301,325,330,331,333,334,336,336,336,336,337,337,337,338,338,331] data: {!! json_encode($growth['total_stmoritz']) !!}
}, },
] ]
}; };
cExtractions.setOption(cExtractionsOptions); cExtractions.setOption(cExtractionsOptions);
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 => {
console.log(prop);
let coords = prop.coordinates.split(',');
L.marker(coords).addTo(map).bindPopup('<a href="/prop/'+prop.id+'">'+prop.coordinates+'</a>');
})
</script> </script>
@endsection @endsection
+17 -2
View File
@@ -3,10 +3,23 @@
<article class="header"> <article class="header">
<header> <header>
<h2> <h2>
Properties pro Region Angaben zur Property
</h2> </h2>
</header> </header>
<div id="chart-props-per-region"></div> <dl>
@foreach ($base as $dt => $dd)
<dt>{{ $dt }}</dt>
<dd>
@if ($dt === 'property_platform_id')
<a href="https://www.e-domizil.ch/rental/{{ $dd }}" rel="noopener noreferrer" target="_blank">
{{ $dd }}
</a>
@else
{{ $dd }}
@endif
</dd>
@endforeach
</dl>
</article> </article>
<article class="header"> <article class="header">
<header> <header>
@@ -24,6 +37,8 @@ const h2Belegung = document.getElementById('belegung-title');
const cCalendarOptions = { const cCalendarOptions = {
timeline: { timeline: {
data: {!! $extractiondates !!}, data: {!! $extractiondates !!},
playInterval: 1000,
axisType: 'time',
left: 0, left: 0,
right: 0, right: 0,
label: { label: {
+11 -2
View File
@@ -5,6 +5,8 @@ use App\Api;
Route::get('/', function () { Route::get('/', function () {
$propertiesGrowth = Api::propertiesGrowth();
$propsPerRegion = Api::propertiesPerRegion(); $propsPerRegion = Api::propertiesPerRegion();
$propsPerRegionName = []; $propsPerRegionName = [];
$propsPerRegionCounts = []; $propsPerRegionCounts = [];
@@ -14,11 +16,15 @@ Route::get('/', function () {
$propsPerRegionCounts[] = $el['count_properties']; $propsPerRegionCounts[] = $el['count_properties'];
} }
return view('overview', ["propsPerRegion" => [json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]); $propertiesGeo = Api::propertiesGeo();
//dump($propertiesGeo);
return view('overview', ["geo" => $propertiesGeo, "growth" => $propertiesGrowth, "propsPerRegion" => [json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]);
}); });
Route::get('/prop/{id}', function (int $id) { Route::get('/prop/{id}', function (int $id) {
$propertyBase = Api::propertyBase($id);
$extractions = Api::propertyExtractions($id); $extractions = Api::propertyExtractions($id);
$data = []; $data = [];
$dates = []; $dates = [];
@@ -27,8 +33,11 @@ Route::get('/prop/{id}', function (int $id) {
$series = []; $series = [];
$dates[] = $ext['created_at']; $dates[] = $ext['created_at'];
$extCalendar = json_decode($ext['calendar'], 1); $extCalendar = json_decode($ext['calendar'], 1);
foreach ($extCalendar as $date => $status) { foreach ($extCalendar as $date => $status) {
$series[] = [$date, $status]; $series[] = [$date, $status];
} }
@@ -37,5 +46,5 @@ Route::get('/prop/{id}', function (int $id) {
} }
return view('property', ["extractiondates" => json_encode($dates), "calendar" => $data]); return view('property', ['base' => $propertyBase[0], "extractiondates" => json_encode($dates), "calendar" => $data]);
}); });
+9 -2
View File
@@ -23,12 +23,19 @@ def properties_region():
@app.get("/properties/growth") @app.get("/properties/growth")
def properties_growth(): def properties_growth():
options = {"dates" : d.properties_growth().pl()['date'].to_list(), "values" : d.properties_growth().pl()['properties_count'].to_list()} options = {"dates" : d.properties_growth().pl()['date'].to_list(), "total_all" : d.properties_growth().pl()['total_all'].to_list(), "total_heidiland" : d.properties_growth().pl()['total_heidiland'].to_list(), "total_engadin" : d.properties_growth().pl()['total_engadin'].to_list(), "total_davos" : d.properties_growth().pl()['total_davos'].to_list(), "total_stmoritz" : d.properties_growth().pl()['total_stmoritz'].to_list()}
return options return options
@app.get("/properties/extractions/{id}") @app.get("/properties/geo")
def properties_geo():
return d.properties_geo().pl().to_dicts()
@app.get("/property/{id}/extractions")
def property_extractions(id: int): def property_extractions(id: int):
return d.extractions_for(property_id = id).pl().to_dicts() return d.extractions_for(property_id = id).pl().to_dicts()
@app.get("/property/{id}/base")
def property_base_data(id: int):
return d.property_base_data(id).pl().to_dicts()
+114 -7
View File
@@ -46,13 +46,93 @@ class Database:
def properties_growth(self): def properties_growth(self):
return self.connection.sql(""" return self.connection.sql("""
WITH PropertiesALL AS (
SELECT
strftime(created_at, '%Y-%m-%d') AS date,
COUNT(*) as properties_count,
SUM(properties_count) OVER (ORDER BY date) AS total
FROM
consultancy_d.properties p
GROUP BY
date
ORDER BY
date
),
PropertiesR1 AS (
SELECT
strftime(created_at, '%Y-%m-%d') AS date,
COUNT(*) as properties_count,
SUM(properties_count) OVER (ORDER BY date) AS total
FROM
consultancy_d.properties p
WHERE
p.seed_id = 1
GROUP BY
date
ORDER BY
date
),
PropertiesR2 AS (
SELECT
strftime(created_at, '%Y-%m-%d') AS date,
COUNT(*) as properties_count,
SUM(properties_count) OVER (ORDER BY date) AS total
FROM
consultancy_d.properties p
WHERE
p.seed_id = 2
GROUP BY
date
ORDER BY
date
),
PropertiesR3 AS (
SELECT
strftime(created_at, '%Y-%m-%d') AS date,
COUNT(*) as properties_count,
SUM(properties_count) OVER (ORDER BY date) AS total
FROM
consultancy_d.properties p
WHERE
p.seed_id = 3
GROUP BY
date
ORDER BY
date
),
PropertiesR4 AS (
SELECT
strftime(created_at, '%Y-%m-%d') AS date,
COUNT(*) as properties_count,
SUM(properties_count) OVER (ORDER BY date) AS total
FROM
consultancy_d.properties p
WHERE
p.seed_id = 4
GROUP BY
date
ORDER BY
date
)
SELECT SELECT
strftime(created_at, '%Y-%m-%d') AS date, p.date,
COUNT(*) as properties_count p.total AS total_all,
pR1.total as total_heidiland,
pR2.total AS total_davos,
pR3.total AS total_engadin,
pR4.total AS total_stmoritz
FROM FROM
consultancy_d.properties PropertiesAll p
GROUP BY LEFT JOIN
date; PropertiesR1 pR1 ON p.date = pR1.date
LEFT JOIN
PropertiesR2 pR2 ON p.date = pR2.date
LEFT JOIN
PropertiesR3 pR3 ON p.date = pR3.date
LEFT JOIN
PropertiesR4 pR4 ON p.date = pR4.date
ORDER BY
p.date
""") """)
def properties_per_region(self): def properties_per_region(self):
@@ -233,9 +313,10 @@ class Database:
consultancy_d.extractions consultancy_d.extractions
WHERE WHERE
type == 'calendar' AND type == 'calendar' AND
property_id = {property_id} property_id = {property_id} AND
calendar NOT NULL
ORDER BY ORDER BY
property_id created_at
""") """)
# Anzahl der extrahierten properties pro Exktraktionsvorgang # Anzahl der extrahierten properties pro Exktraktionsvorgang
@@ -281,3 +362,29 @@ class Database:
ORDER BY property_id ORDER BY property_id
""") """)
def property_base_data(self, id):
return self.connection.sql(f"""
SELECT
p.property_platform_id,
p.created_at as first_found,
p.last_found,
r.name as region_name
FROM
consultancy_d.properties p
INNER JOIN consultancy_d.seeds s ON s.id = p.seed_id
INNER JOIN consultancy_d.regions r ON s.region_id = r.id
WHERE
p.id = {id}
""")
def properties_geo(self):
return self.connection.sql("""
SELECT
p.id,
p.check_data as coordinates
FROM
consultancy_d.properties p
""")
-17
View File
@@ -1,17 +0,0 @@
import data
import polars as pl
inst = data.load()
"""
test = inst.extractions_for(1).pl()
out = test.with_columns(
pl.col("calendar").str.extract_all(r"([0-9]{4}-[0-9]{2}-[0-9]{2})|[0-2]").alias("extracted_cal"),
)
out = out.drop(['calendar', 'property_id'])
print(out.to_dict(as_series=True))
"""
print(inst.price_developement_per_property().pl())