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 $f;
protected function getData(): array
{
$this->f = $this->filters;
$this->heading = 'Events';
$data = LoadEvents::load($this->filters);
@@ -36,26 +40,54 @@ class ChartPunctualEvent extends ChartWidget
protected function getOptions(): RawJs
{
return RawJs::make(<<<'JS'
{
interaction: {
intersect: false,
},
plugins: {
tooltip: {
callbacks: {
label: (context) => {
return [' '+context.parsed.y, context.dataset.events[context.dataIndex], context.dataset.results_per_event[context.dataIndex]];
},
}
$filter = $this->f;
switch ($filter['similar_past_matches']) {
case 'none':
return RawJs::make(<<<'JS'
{
interaction: {
intersect: false,
},
},
scales: {
y: {
beginAtZero:true,
plugins: {
tooltip: {
callbacks: {
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);
}
}