livewire-charts icon indicating copy to clipboard operation
livewire-charts copied to clipboard

Uncaught TypeError: Cannot read properties of undefined (reading 'get')

Open vivekaris opened this issue 3 years ago • 3 comments

Describe the bug Uncaught TypeError: Cannot read properties of undefined (reading 'get') at Proxy.drawChart (app.js:3:472873) at app.js:3:472785

To Reproduce Steps to reproduce the behavior:

  1. '$columnChartModel = (new ColumnChartModel()) ->setTitle('Expenses by Type') ->addColumn('Food', 100, '#f6ad55') ->addColumn('Shopping', 200, '#fc8181') ->addColumn('Travel', 300, '#90cdf4') ;'

  2. '<livewire:livewire-column-chart :column-chart-model="$columnChartModel" />'

  3. 'Uncaught TypeError: Cannot read properties of undefined (reading 'get') at Proxy.drawChart (app.js:3:472873) at app.js:3:472785'

Solution Ideas thinking

vivekaris avatar Feb 18 '22 19:02 vivekaris

This is probably because Livewire is not properly initialized or not installed, follow these instructions:

Requirements

This package requires the following packages/libraries to work:

  • Laravel Livewire v2 (https://laravel-livewire.com/)
  • Alpine Js (https://github.com/alpinejs/alpine)
  • Apex Charts (https://apexcharts.com/)

Please follow each package/library instructions on how to set them properly in your project.

Next, include the @livewireChartsScripts directive next to your other app scripts

<livewire:scripts />
@livewireChartsScripts

Solotov avatar Apr 25 '22 02:04 Solotov

I get the same error. Even Livewire works well on other pages. Screenshot 2022-05-17 at 05 22 49 I tried with local apexcharts: <script src="{{asset('js/apexcharts.js')}}"></script> @livewireScripts @livewireChartsScripts but error didn't disappear.

stojankukrika avatar May 17 '22 03:05 stojankukrika

This was my issue an hour ago. I just found out that I did not add window.Alpine = Alpine in my bundle after importing the Alpine module.

I hope this helps.

hearthlytorepalma avatar Oct 07 '23 07:10 hearthlytorepalma