PHP Classes


Recommend this page to a friend!
  Classes of Ariel Mejia Dev   APEXCharts Laravel Charts Library   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: APEXCharts Laravel Charts Library
Display charts on a page using APEXCharts library
Author: By
Last change:
Date: 3 years ago
Size: 1,796 bytes


Class file image Download

Larapex Charts

A Laravel wrapper for apex charts library.


Use composer.

composer require arielmejiadev/larapex-charts


Basic example

In your controller add:

$chart = LarapexChart::setTitle('Posts')
                   ->setDataset([150, 120])
                   ->setLabels(['Published', 'No Published']);

Remember to import the Facade to your controller with

use ArielMejiaDev\LarapexCharts\Facades\LarapexChart

Or importing the LarapexChart class:

use ArielMejiaDev\LarapexCharts\LarapexChart;

Then in your view (Blade file) add:

 <!doctype html>
 <html lang="en">
     <meta charset="UTF-8">
     <meta name="viewport"
           content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     <title>Chart Sample</title>
     {!! $chart->container() !!}
     <script src="{{ $chart->cdn() }}"></script>
     {{ $chart->script() }}

More complex example

$chart = LarapexChart::setType('area')
        ->setTitle('Total Users Monthly')
        ->setSubtitle('From January to March')
            'Jan', 'Feb', 'Mar'
                'name'  =>  'Active Users',
                'data'  =>  [250, 700, 1200]

You can create a variety of charts including: Line, Area, Bar, Horizantal Bar, Heatmap, pie, donut and Radialbar.

More examples

Check the documentation on: Larapex Chart Docs


The author Ariel Mejia Dev.