Blog Detail

22

Jun
Generate Modern Charts with ApexCharts Package in Laravel cover image

arrow_back Generate Modern Charts with ApexCharts Package in Laravel

ApexCharts is a package for laravel that allows you to generate modern and interactive charts using the ApexCharts library directly from Laravel without interacting with JavaScript, CSS, etc. It covers all of the chart types and options available within the ApexCharts library

Getting Started

1. Installation

Run the following command:

composer require akaunting/laravel-apexcharts

2. Publish

Publish configuration

php artisan vendor:publish --tag=apexcharts

3. Configure

You can change the chart settings of your app from config/apexcharts.php file.

Usage

First of all, create an instance of the Chart class and set the data and options according to your needs.

use Akaunting\Apexcharts\Chart;

...

$chart = (new Chart)->setType('donut')
    ->setWidth('100%')
    ->setHeight(300)
    ->setLabels(['Sales', 'Deposit'])
    ->setDataset('Income by Category', 'donut', [1907, 1923]);

Then, include the JavaScript (on every page using charts).

</head>
<body>
    ...

    @apexchartsScripts
</body>

Finally, call the container and script method wherever you want to display the chart.

{!! $chart->container() !!}

{!! $chart->script() !!}

For more details about this package, You can visit Github.

Note

If you have an idea then Codebrisk is always here to convert your ideas into reality. Our team of expert developers is trained in Laravel custom web app development, CRM software development, and e-commerce app development. We run with a superior level of agility and an immense Laravel ecosystem to customize the software for your business. For further assistance, please contact us or you can launch a project with us.

Published at : 22-06-2022

Author : Rizwan Aslam
AUTHOR
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project