asantibanez / livewire-charts

Neat Livewire Charts for your Laravel projects
MIT License
788 stars 116 forks source link

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

Open vivekaris opened 2 years ago

vivekaris commented 2 years ago

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

Solotov commented 2 years ago

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:

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
stojankukrika commented 2 years ago

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.

hearthlytorepalma commented 9 months ago

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.