Enhance coordinated view of property.

main
Giò Diani 2024-12-20 12:20:49 +01:00
parent 63590d69ab
commit 66d048c70e
2 changed files with 22 additions and 27 deletions

View File

@ -61,15 +61,13 @@ const cCapacityOptions = {
min: 0, min: 0,
max: 100 max: 100
}, },
series: [ series: {
{
name: 'Alle', name: 'Alle',
type: 'line', type: 'line',
stack: 'Total', stack: 'Total',
symbolSize: 7, symbolSize: 7,
data: {!! json_encode($capacities['capacities']) !!} data: {!! json_encode($capacities['capacities']) !!}
} }
]
}; };
cCapacity.setOption(cCapacityOptions); cCapacity.setOption(cCapacityOptions);
@ -82,7 +80,7 @@ const h2Belegung = document.getElementById('belegung-title');
const cCalendarOptions = { const cCalendarOptions = {
timeline: { timeline: {
data: {!! $extractiondates !!}, data: {!! $extractiondates !!},
playInterval: 1000, playInterval: 2000,
axisType: 'time', axisType: 'time',
left: 0, left: 0,
right: 0, right: 0,
@ -114,26 +112,26 @@ const cCalendarOptions = {
{ {
orient: 'horizontal', orient: 'horizontal',
range: '2024', range: '2024',
top: 50, top: '6.25%',
right: 10, right: 10,
bottom: '68.75%',
left: 50, left: 50,
bottom: "66%"
}, },
{ {
orient: 'horizontal', orient: 'horizontal',
range: '2025', range: '2025',
top: '37.5%',
right: 10, right: 10,
bottom: '37.25%',
left: 50, left: 50,
top: '43%',
bottom: '43%'
}, },
{ {
orient: 'horizontal', orient: 'horizontal',
range: '2026', range: '2026',
top: '68.75%',
right: 10, right: 10,
bottom: '6.25%',
left: 50, left: 50,
top: '66%',
bottom: '10%'
} }
], ],
options: [ options: [
@ -164,28 +162,26 @@ const cCalendarOptions = {
cCalendar.setOption(cCalendarOptions); cCalendar.setOption(cCalendarOptions);
cCalendar.on('timelinechanged', (e) => { cCalendar.on('timelinechanged', (e) => {
// Change header text according to datapoint
h2Belegung.innerText = "Belegung am "+cCalendarOptions.timeline.data[e.currentIndex]; h2Belegung.innerText = "Belegung am "+cCalendarOptions.timeline.data[e.currentIndex];
/*
series = cCalendarOptions.series[0].data // Set markpoint on linechart
series[e.currentIndex] let x = cCapacityOptions.xAxis.data[e.currentIndex];
series: [ let y = cCapacityOptions.series.data[e.currentIndex];
{
name: 'Alle',
type: 'line',
stack: 'Total',
symbolSize: 7,
data: {!! json_encode($capacities['capacities']) !!}
}
]
cCapacity.setOption({ cCapacity.setOption({
series: {
markPoint: {
}) data: [{
*/ coord: [x, y]
}]
}
}
});
}) })
cCapacity.on('click', 'series', (e) => { cCapacity.on('click', 'series', (e) => {
// Switch to correct calendar in the timeline
cCalendar.dispatchAction({ cCalendar.dispatchAction({
type: 'timelineChange', type: 'timelineChange',
currentIndex: e.dataIndex currentIndex: e.dataIndex

View File

@ -27,7 +27,6 @@ def property_capacities(id: int):
liste = [x for x in dates if x is not None] liste = [x for x in dates if x is not None]
count_days.append(len(liste)) count_days.append(len(liste))
print(sum_hor)
counts = pl.DataFrame({"count_days" : count_days, "sum" : sum_hor}) counts = pl.DataFrame({"count_days" : count_days, "sum" : sum_hor})
result = {"capacities": [], "dates": extractions['created_at'].cast(pl.Datetime).to_list() } result = {"capacities": [], "dates": extractions['created_at'].cast(pl.Datetime).to_list() }