wip tooltip with events
This commit is contained in:
1 parent
06dbeb1ed8
commit
ec9e380d33
4 files changed
+73
-36
No files matched your search
@@ -4,6 +4,7 @@ namespace App\Filament\Widgets;
|
||||
|
||||
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;
|
||||
|
||||
@@ -13,22 +14,6 @@ class ChartPunctualEvent 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);
|
||||
@@ -46,4 +31,29 @@ class ChartPunctualEvent 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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user