LaravelDaily/laravel-charts

Undefined array key "data"

elmarzouguidev opened this issue · 3 comments

Undefined array key "data"
vendor\laraveldaily\laravel-charts\src\views\javascript.blade.php

data: {

        labels: [

            @if (count($datasets) > 0)

                @foreach ($datasets[0]['data'] as $group => $result)

                    "{{ $group }}",

                @endforeach

            @endif

Laravel 8

Fixed it's a error by me
$chart_options = [
'chart_title' => 'Users by months',
'report_type' => 'group_by_date',
'model' => 'App\Models\Sameleon\User',
'group_by_field' => 'created_at',
'group_by_period' => 'month',
'chart_type' => 'bar',
'filter_field' => 'created_at',
'filter_days' => 30, // show only last 30 days
];

I have a Folder named "Sameleon" in Moldes Directory so i forget to put them in the Model key : 'model' => 'App\Models\Sameleon\User',


I got same problem

@richyzak the problem is coming from the Namespace of the Model verify your Model's namespace