This commit is contained in:
salam committed 2026-05-27 15:55:46 +02:00
1 parent c329d5a6f5
commit 847fdb80cc
1 file changed
+50 -18
+50 -18
View File
@@ -14,8 +14,12 @@ class ChartPunctualEvent extends ChartWidget
protected ?string $pollingInterval = null; protected ?string $pollingInterval = null;
protected $f;
protected function getData(): array protected function getData(): array
{ {
$this->f = $this->filters;
$this->heading = 'Events'; $this->heading = 'Events';
$data = LoadEvents::load($this->filters); $data = LoadEvents::load($this->filters);
@@ -36,26 +40,54 @@ class ChartPunctualEvent extends ChartWidget
protected function getOptions(): RawJs protected function getOptions(): RawJs
{ {
return RawJs::make(<<<'JS' $filter = $this->f;
{
interaction: { switch ($filter['similar_past_matches']) {
intersect: false, case 'none':
}, return RawJs::make(<<<'JS'
plugins: { {
tooltip: { interaction: {
callbacks: { intersect: false,
label: (context) => {
return [' '+context.parsed.y, context.dataset.events[context.dataIndex], context.dataset.results_per_event[context.dataIndex]];
},
}
}, },
}, plugins: {
scales: { tooltip: {
y: { callbacks: {
beginAtZero:true, label: (context) => {
return [' '+context.parsed.y, context.dataset.events[context.dataIndex], context.dataset.results_per_event[context.dataIndex]];
},
}
},
}, },
}, scales: {
y: {
beginAtZero:true,
},
},
}
JS);
default:
return RawJs::make(<<<'JS'
{
interaction: {
intersect: false,
},
plugins: {
tooltip: {
callbacks: {
label: (context) => {
return [context.dataset.events[context.dataIndex], context.dataset.results_per_event[context.dataIndex]];
},
}
},
},
scales: {
y: {
beginAtZero:true,
},
},
}
JS);
break;
} }
JS);
} }
} }