This commit is contained in:
salam committed 2026-05-28 18:21:50 +02:00
1 parent 6d5b05e561
commit 7cb30a256c
5 files changed
+156 -2

No files matched your search

@@ -0,0 +1,75 @@
<?php
namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperMoveingAveragePerformens;
use App\Filament\Widgets\Data\LoadPerformance;
use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget;
use Filament\Widgets\Concerns\InteractsWithPageFilters;
class ChartEventPerfMoAv extends ChartWidget
{
use InteractsWithPageFilters;
protected ?string $heading = 'Events';
protected ?string $description = 'Performance Moving Average';
protected ?string $pollingInterval = null;
protected bool $isCollapsible = true;
protected function getData(): array
{
$data = LoadPerformance::load($this->filters);
if ($data) {
HelperMoveingAveragePerformens::get($data);
}
return $data;
}
protected function getType(): string
{
return 'line';
}
protected function getOptions(): RawJs
{
return RawJs::make(<<<'JS'
{
interaction: {
intersect: false,
},
// plugins: {
// tooltip: {
// callbacks: {
// label: (context) => {
// return [' '+context.parsed.y, ' '+context.dataset.playing_date[context.dataIndex], ' '+context.dataset.events[context.dataIndex], ' '+context.dataset.results_per_event[context.dataIndex]];
// },
// }
// }
// },
scales: {
x: {
title: {
display: true,
text: 'Days since today'
}
},
y: {
beginAtZero:false,
ticks: {
callback: function(value, index, ticks) {
return value % 1 === 0 ? value : '';
}
}
},
},
}
JS);
}
}