wip tooltip with events

This commit is contained in:
salam committed 2026-05-25 13:05:11 +02:00
1 parent 06dbeb1ed8
commit ec9e380d33
4 files changed
+73 -36

No files matched your search

@@ -5,6 +5,7 @@ namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperMoveingAverage;
use App\Filament\Widgets\Data\HelperStatisticType;
use App\Filament\Widgets\Data\LoadEvents;
use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget;
use Filament\Widgets\Concerns\InteractsWithPageFilters;
@@ -14,22 +15,6 @@ class ChartMovingAverageEvent extends ChartWidget
protected ?string $pollingInterval = null;
protected ?array $options = [
'plugins' => [
'legend' => [
'display' => true,
],
],
'interaction' => [
'intersect' => false,
],
'scales' => [
'y' => [
'beginAtZero' => true,
],
],
];
protected function getData(): array
{
$this->heading = 'Events '.HelperStatisticType::get($this->filters);
@@ -49,4 +34,29 @@ class ChartMovingAverageEvent extends ChartWidget
{
return 'line';
}
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]];
},
}
},
},
scales: {
y: {
beginAtZero:true,
},
},
}
JS);
}
}