Events ' . $this->type . ' Moving Average '); } protected function getData(): array { $data = LoadEvents::load($this->filters, false); $this->type = ucfirst(HelperStatisticType::get($this->filters)); 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: { legend: { position: 'left', }, tooltip: { callbacks: { label: (context) => { if(context.dataset.label == 'Average League' || context.dataset.label == 'Average Team'){ return [context.dataset.label+' '+context.dataset.data[0]]; } else { 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: 'Number of days since the event' } }, y: { beginAtZero:false, }, }, } JS); } }