Bar Chart Widget labels not working (showing undefined)
I tried this values in return value for getData it shows undefined:
protected function getData(): array
{
return [
'datasets' => [
[
'data' => ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
'backgroundColor' => $this->getColors(),
'borderColor' => $this->getColors()
],
],
'labels' => ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'],
];
}
protected function getType(): string
{
return 'bar';
}
protected function getColors(): array
{
return [
'#0A2B47', '#0E436C', '#0A5182', '#075F9D', '#0776C2', '#1496E3',
'#3BAFF3', '#80CAF9', '#BCE1FB', '#F0F8FF'
];
}protected function getData(): array
{
return [
'datasets' => [
[
'data' => ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
'backgroundColor' => $this->getColors(),
'borderColor' => $this->getColors()
],
],
'labels' => ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'],
];
}
protected function getType(): string
{
return 'bar';
}
protected function getColors(): array
{
return [
'#0A2B47', '#0E436C', '#0A5182', '#075F9D', '#0776C2', '#1496E3',
'#3BAFF3', '#80CAF9', '#BCE1FB', '#F0F8FF'
];
}