Register new chart type
How to register new chart type from the community? I installed the new chart type package and tried to register it like this but still got the error.
I think because I register to the wrong one, not the chart object Filament is using to render chart, but I don't know how to get the right one.
5 Replies
I have a vey similar challenge, as I want to register a chartjs plugin.
@Mads Møller
i have to copy the chart.js file in vendor, add the register code, then build it with esbuild, then use filament asset to publish it to public folder
1. install chartjs and plugin via npm
2. copy
vendor/filament/widgets/resources/js/components/chart.js
to resources/js
folder
3. follow these steps: https://filamentphp.com/docs/3.x/support/assets#asynchronous-alpinejs-components
4. copy vendor/filament/widgets/resources/views/chart-widget.blade.php
to resources/views/vendor/filament-widgets/chart-widget.blade.php
5. replace line 38 with ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('chartjs') }}"
awesome, thank you @awsqed! one note: for me to get it working i had to copy the view into
resources/views/vendor/filament-widgets/chart-widget.blade.php
.@maltebaer
oh yeah my mistake, missing the
views
in paththanks, some one need to add this to the docs please