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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners