leandrocfe / filament-apex-charts

Apex Charts integration for Filament PHP.
https://filament-apex-charts-demo.leandroferreira.dev.br
MIT License
286 stars 36 forks source link

Support formatter options #55

Closed glennjacobs closed 6 months ago

glennjacobs commented 6 months ago

Closes #15 #16

This pull request looks to add the ability to use formatters in the Apex chart options.

This is important as charts are often used for monetary values and therefore want to be formatted as such.

E.g. 123456.0 vs $123,456.00

You can now do something like the following

'labels' => [
    'formatter' => 'function (value) { return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value); }',
],
glennjacobs commented 6 months ago

Converted to draft as there seems to be an issue with the auto-refresh.

glennjacobs commented 6 months ago

This should be good now.

leandrocfe commented 6 months ago

Thank you, but I used RawJs to make it https://github.com/leandrocfe/filament-apex-charts?tab=readme-ov-file#extra-options-and-formatters

glennjacobs commented 6 months ago

Thank you, but I used RawJs to make it

https://github.com/leandrocfe/filament-apex-charts?tab=readme-ov-file#extra-options-and-formatters

Ok cool. I'll check it out.