displayLegend(true); if($values['type'] == 'in'){ $this->labels($values['labels']); $this->dataset('Answered', 'bar', $values['answered'])->color('#5DBA5D')->backgroundColor('#5DBA5D'); $this->dataset('Missed', 'bar', $values['missed'])->color('#FF3333')->backgroundColor('#FF3333'); }elseif($values['type'] == 'out'){ $labels = []; $answered = []; $busy = []; $unans = []; $failed = []; foreach ($values['data'] as $v){ $labels[] = $v['label']; $answered[] = $v['answord']; $busy[] = $v['busy']; $unans[] = $v['unans']; $failed[] = $v['failed']; } $this->labels($labels); $this->dataset('ANSWERED', 'bar', $answered)->color('#5DBA5D')->backgroundColor('#5DBA5D'); $this->dataset('BUSY', 'bar', $busy)->color('#FFA500')->backgroundColor('#FFA500'); $this->dataset('NO ANSWER', 'bar', $unans)->color('#FF4500')->backgroundColor('#FF4500'); $this->dataset('FAILED', 'bar', $failed)->color('#8B0000')->backgroundColor('#8B0000'); } } }