Do you host the code in github, to get more context, please just review if you are importing the package class, you need to add the namespace of the package class:
useArielMejiaDev\LarapexCharts;
This is something that the editor can do automatically by you, since I got only the code from the controller method I cannot verify if you has this class imported
Hi Sammy, excuse me for the wait, today I make some time to review the code, I create an example using the data that you want, everything is working fine just remeber in docs I add an alert on line, area charts because in this charts you can represent more than one series of data you need to set the data like this:
As you can see its a multidimensional array an every subset is an associative array, then you can see that the "data" key has an array as its value, I add a live example here: github.com/ArielMejiaDev/Larapex-C...
you can check the code, thanks for using Larapex Charts, I saw your dashboard project so I add the example using Tailwindcss to you can get a pretty good idea how it looks on your project, please let me know about your project it seems very interesting, there is something more that I could help you I will be here.
Thank you for your feedback. I appreciate your effort to help me. I was trying to use your package for charts on my project instead of using chartsJs. I will follow your advice and also check your example there to rectify the problem.
Thanks also for the interest in my project. It's an open-source TALL Stack dashboard. I am trying to make sure all the technologies have been represented well on the dashboard. Tailwind for UI design, Alpine Js, and Livewire for UX and of course Laravel for backend stuff. I have implemented the new Laravel component features also. It's still a WIP though. I'll need to clean the code once I am done with everything.
You're welcome to fork or do a pull request. Or give me a star.
I have noticed something with the "undefined variable $chart" error. It was caused when I moved the main layout file to the components folder. That is when I started to implement the Laravel's components feature.
I have created a similar file and placed it on the layouts folder and changed my view file to use the initial methods; @extends and @yield().
Hi, you are using the new Laravel components? in this case if you are using variables you need to add a class to add the component logic, look at "app/Views" folder, you can create a view composition class with the artisan command: "php artisan make:component yourcomponent", then it will add a file with a render function that calls directly the view then in the constructor add the $chart variable that you need maybe something like:
phpartisanmake:componentEarningsChart
go to app/Views/chart.php
<?phpnamespaceApp\View\Components;useIlluminate\View\Component;useArielMejiaDev\LarapexCharts\LarapexChart;classAlertextendsComponent{/**
* Chart instance.
*
*/public$chart;/**
* Create the component instance.
*
* @param $chart
* @return void
*/publicfunction__construct(LarapexChart$chart){$this->chart=(newLarapexChart)->setType('line')->setTitle('Earnings')->setXAxis(['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'])->setDataset([['name'=>'Earnings','data'=>[0,10000,15000,10000,20000,15000,25000,20000,30000,25000,40000]]]);}/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\View\View|string
*/publicfunctionrender(){returnview('components.alert');}}
Please let me know if this approach works, and congrats your Tall dashboard looks amazing, I am doing a secret open source project with similar aproach but I prefer VueJS
hi,, i'm using larapexchart in laravel but i keep on getting a error .. saying that Call to a member function container() on array.. can you help me please...
If you want to share the code I can give a look at the code, alternatively you can make a "dd()" to the chart variable before pass it to the view and check that its a LarapexChart object instance.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The charts cannot now show on browser. I get this error on console log:
Uncaught ReferenceError: ApexCharts is not defined
Do you add the CDN of apexcharts in your blade layout file? if you dont want to go to the apexchart site to get the cdn you can use the helper
Remember to print in the script tags you need the bang bang syntax not the blade mustaches.
Do you host the code in github, to get more context, please just review if you are importing the package class, you need to add the namespace of the package class:
This is something that the editor can do automatically by you, since I got only the code from the controller method I cannot verify if you has this class imported
This is the github code:
github.com/sammymwangangi/TALL-Das...
Hi Sammy, excuse me for the wait, today I make some time to review the code, I create an example using the data that you want, everything is working fine just remeber in docs I add an alert on line, area charts because in this charts you can represent more than one series of data you need to set the data like this:
As you can see its a multidimensional array an every subset is an associative array, then you can see that the "data" key has an array as its value, I add a live example here: github.com/ArielMejiaDev/Larapex-C...
you can check the code, thanks for using Larapex Charts, I saw your dashboard project so I add the example using Tailwindcss to you can get a pretty good idea how it looks on your project, please let me know about your project it seems very interesting, there is something more that I could help you I will be here.
Thank you for your feedback. I appreciate your effort to help me. I was trying to use your package for charts on my project instead of using chartsJs. I will follow your advice and also check your example there to rectify the problem.
Thanks also for the interest in my project. It's an open-source TALL Stack dashboard. I am trying to make sure all the technologies have been represented well on the dashboard. Tailwind for UI design, Alpine Js, and Livewire for UX and of course Laravel for backend stuff. I have implemented the new Laravel component features also. It's still a WIP though. I'll need to clean the code once I am done with everything.
You're welcome to fork or do a pull request. Or give me a star.
I have noticed something with the "undefined variable $chart" error. It was caused when I moved the main layout file to the components folder. That is when I started to implement the Laravel's components feature.
I have created a similar file and placed it on the layouts folder and changed my view file to use the initial methods; @extends and @yield().
Hi, you are using the new Laravel components? in this case if you are using variables you need to add a class to add the component logic, look at "app/Views" folder, you can create a view composition class with the artisan command: "php artisan make:component yourcomponent", then it will add a file with a render function that calls directly the view then in the constructor add the $chart variable that you need maybe something like:
go to app/Views/chart.php
Please let me know if this approach works, and congrats your Tall dashboard looks amazing, I am doing a secret open source project with similar aproach but I prefer VueJS
Thanks for your feedback. I will try out this approach and I'll let you know if it works. Also, I can't wait to see your project.
Thanks!
hi,, i'm using larapexchart in laravel but i keep on getting a error .. saying that Call to a member function container() on array.. can you help me please...
Hi there! thanks for using Larapex charts, here is a live sample with TailwindCSS: larapex-chart-example.herokuapp.com/
Here the controller where I built the charts: github.com/ArielMejiaDev/Larapex-C...
Here the view: github.com/ArielMejiaDev/Larapex-C...
If you want to share the code I can give a look at the code, alternatively you can make a "dd()" to the chart variable before pass it to the view and check that its a LarapexChart object instance.