'.$this->player.'
'.$this->type.' Moving Average
');
}
protected function getData(): array
{
$data = LoadPlayer::load($this->filters, false);
if ($data) {
$this->player = $data['player_name'] ?? '';
$this->type = ucfirst(HelperStatisticType::get($this->filters));
HelperMoveingAverage::get($data);
}
return $data;
}
protected function getType(): string
{
return 'line';
}
protected function getOptions(): RawJs
{
return RawJs::make(<<<'JS'
{
interaction: {
intersect: false,
},
plugins: {
legend: {
position: 'left',
},
},
scales: {
x: {
title: {
display: true,
text: 'Days since today'
}
},
y: {
beginAtZero:true,
ticks: {
callback: function(value, index, ticks) {
return value % 1 === 0 ? value : '';
}
}
},
},
}
JS);
}
}