Recent works require me to work with Livewire and ChartJs. Prepare our simple filter: php artisan make:livewire Filter

Let's update our Livewire chart blade file: @once @push('scripts') @endpush @endonce @push('scripts') @endpush Note that, there is few things happened here: The @once only use to include the ChartJs once in entire app.

The key point is the Event & Listener of the Livewire: Configure the Livewire Listener on frontend side: Livewire.on('updateChart', data => { chart.data = data; chart.update(); }); And emit event from Livewire backend side, to pass new data: $this->emit('updateChart', $data); With these two key points, hopes to help people work with dynamic charts with Livewire.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners