Use chart widget (standalone)
Hey! Is it possible to use the chart widget on my website without filament like the table builder?
9 Replies
Hi @divdax ! I believe it is coming in v3! Might be a plugin to do it now, but I am not sure ^^
yes your right. in v3 the widget has its own package
@divdax It's been a while so my memory could be wonky here but I remember being able to reuse a widget between the Admin and the front-end part of a site...
A Widget is just a Livewire component in the end, so I think all that's needed is to also register the Livewire component for the rest of your app
Something like:
Livewire::register('my-frontend-widget', MyWidget::class)
in a service provider
then @livewire('my-frontend-widget')
thank you @pboivin registered a chart component via serviceprovider
Livewire::component('chart', TestChart::class);
and can use it on my frontend. i just have to load chart.js in my frontend assets.@divdax How did you add the chart.js in your front-end assets?
Did you find any way to load it automatically in Filament v2?
pulled in chart.js via cdn
What version of Chart.js did you use?
just used the latest, i think v4. after that i pulled it in via npm so it gets served by my app.js
Thanks, let me try the NPM route seems like the CDN is not working
Found the issue my data was the one with breaking contentsw