Achsenbeschrftungen, Farben

main
Giò Diani 2025-01-03 16:25:30 +01:00
parent 640a5b2f9e
commit 5a2cc96a95
7 changed files with 78 additions and 39 deletions

View File

@ -108,3 +108,16 @@ article>header>h2{
font-size: 1em; font-size: 1em;
font-weight: 600; font-weight: 600;
} }
@media(max-width: 960px){
body{
height: auto;
}
main{
height: auto;
grid-template-columns: 100%;
grid-template-rows: repeat(4, minmax(20em, 25em));
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -28,24 +28,29 @@
<div id="chart-heatmap"></div> <div id="chart-heatmap"></div>
</article> </article>
<script type="module"> <script type="module">
const hours = [
'12a', '1a', '2a', '3a', '4a', '5a', '6a',
'7a', '8a', '9a', '10a', '11a',
'12p', '1p', '2p', '3p', '4p', '5p',
'6p', '7p', '8p', '9p', '10p', '11p'
];
const extractionDates = {!! json_encode($growth['dates']) !!}; const sharedOptions = {
basic: {
color: ['#f1eef6','#bdc9e1','#74a9cf','#2b8cbe','#045a8d'],
// prettier-ignore grid: {
let data = []; top: 20,
left: 60,
for(let i = 0; i <= extractionDates.length; i++){ right: 0,
for(let j = 0; j <= hours.length; j++){ bottom: 50
data.push([j,i,Math.random() * 3]); },
name: (opt) => {
return {
name: opt.name,
nameLocation: opt.location,
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
},
}
}
} }
} }
const extractionDates = {!! json_encode($growth['dates']) !!};
const chartHeatmap = document.getElementById('chart-heatmap'); const chartHeatmap = document.getElementById('chart-heatmap');
const cHeatmap = echarts.init(chartHeatmap); const cHeatmap = echarts.init(chartHeatmap);
@ -54,16 +59,20 @@ const cHeatmapOptions = {
position: 'top' position: 'top'
}, },
grid: { grid: {
top: 0, top: 25,
right: 0, right: 0,
bottom: 0, bottom: 0,
left: 0 left: 0
}, },
xAxis: { xAxis: {
name: 'Kurzzeitmietobjekt',
type: 'category', type: 'category',
data: {!! json_encode($heat['property_ids']) !!}, data: {!! json_encode($heat['property_ids']) !!},
splitArea: { splitArea: {
show: false show: false
},
axisLabel: {
show: true,
} }
}, },
yAxis: { yAxis: {
@ -74,25 +83,32 @@ const cHeatmapOptions = {
} }
}, },
visualMap: { visualMap: {
type: 'piecewise',
min: 0, min: 0,
max: 100, max: 100,
calculable: true, calculable: true,
orient: 'horizontal', orient: 'horizontal',
left: 'center', left: 'center',
bottom: '15%' top: 0,
inRange: {
color: ['#f1eef6','#bdc9e1','#74a9cf','#2b8cbe','#045a8d']
},
}, },
series: [ series: [
{ {
name: 'Punch Card', name: 'Auslastung',
type: 'heatmap', type: 'heatmap',
data: {!! json_encode($heat['values']) !!}, data: {!! json_encode($heat['values']) !!},
label: { label: {
show: false show: false
}, },
tooltip: {
formatter: '{b0}: {c0}<br />{b1}: {c1}',
},
emphasis: { emphasis: {
itemStyle: { itemStyle: {
shadowBlur: 10, borderColor: '#000',
shadowColor: 'rgba(0, 0, 0, 0.5)' borderWidth: 2
} }
} }
} }
@ -104,19 +120,25 @@ cHeatmap.setOption(cHeatmapOptions);
const chartPropsPerRegion = document.getElementById('chart-props-per-region'); const chartPropsPerRegion = document.getElementById('chart-props-per-region');
const cPropsPerRegion = echarts.init(chartPropsPerRegion); const cPropsPerRegion = echarts.init(chartPropsPerRegion);
const cPropsPerRegionOptions = { const cPropsPerRegionOptions = {
grid: { grid: sharedOptions.basic.grid,
top: 20,
left: 30,
right: 0,
bottom: 20
},
xAxis: { xAxis: {
name: 'Region',
nameLocation: 'center',
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
},
type: 'category', type: 'category',
data: {!! $propsPerRegion[0] !!} data: {!! $propsPerRegion[0] !!}
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
name: 'Anzahl Kurzzeitmietobjekte',
nameLocation: 'middle',
nameGap: 38,
nameTextStyle: {
fontWeight: 'bold',
},
}, },
series: [ series: [
{ {
@ -142,18 +164,26 @@ const cExtractionsOptions = {
legend: { legend: {
data: filters.regions data: filters.regions
}, },
grid: { color: sharedOptions.basic.color,
left: '0', grid: sharedOptions.basic.grid,
right: 10,
bottom: '0',
containLabel: true
},
xAxis: { xAxis: {
name: 'Zeitpunkt Scraping',
nameLocation: 'center',
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
},
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: extractionDates data: extractionDates
}, },
yAxis: { yAxis: {
name: 'Anzahl Kurzzeitmietobjekte',
nameLocation: 'center',
nameGap: 38,
nameTextStyle: {
fontWeight: 'bold',
},
type: 'value' type: 'value'
}, },
series: [ series: [

View File

@ -1,4 +1,4 @@
# How to run # How to run
```bash ```bash
fastapi dev api/main.py fastapi dev api/main.py --port 8080
``` ```