wip design
This commit is contained in:
1 parent
a862442e9f
commit
bf2aa801fc
13 files changed
+283
-266
No files matched your search
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
|
||||
class ChartEventMoAv extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
protected bool $isCollapsible = true;
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
$this->heading = 'Events';
|
||||
|
||||
$data = LoadEvents::load($this->filters);
|
||||
|
||||
$this->description = ucfirst(HelperStatisticType::get($this->filters)).' Moving Average';
|
||||
|
||||
if ($data) {
|
||||
|
||||
if (isset($data['description'])) {
|
||||
$this->description .= $data['description'];
|
||||
}
|
||||
|
||||
HelperMoveingAverage::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.events[context.dataIndex], context.dataset.results_per_event[context.dataIndex]];
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero:true,
|
||||
},
|
||||
},
|
||||
}
|
||||
JS);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user