LaravelDaily / laravel-charts

Package to draw charts in Laravel with Chart.js
MIT License
531 stars 118 forks source link

Chart can't group on Model Enum properties #112

Closed htdung83 closed 1 year ago

htdung83 commented 1 year ago

I've a Model with option field stored Enum value. I installed a chart with $option['group_by_field'] = 'db field name'. It threw Laravel Charts error: array_key_exists(): Argument #1 ($key) must be a valid array offset type. For instance, I created a new column with same value and set it as group_by_field. It worked. You know that it's not the good solution. Hope you can fix that soon.

Thanks a lot.

PovilasKorop commented 1 year ago

@htdung83 it's not about enum.

Read the docs please, the value of that parameter is REQUIRED, otherwise the chart doesn't know what to group by.

group_by_field (required) - name of database field that will be used in

htdung83 commented 1 year ago

I am sorry. My mistake on writting issue content. I updated my question.

PovilasKorop commented 1 year ago

@htdung83 ok now I see.

We never built anything specifically for Enums.

So it's not a bug. It's just a feature we never implemented.

We don't plan any new features at the moment, but if someone (you?) makes a Pull Request for it, we would gladly test and accept it.

htdung83 commented 1 year ago

@PovilasKorop thanks for your quick reponse. Will do that.