digital-creative / nova-apex-chart

A Laravel Nova Apex Chart Component.

Stars
0

Nova Apex Chart

Latest Version on Packagist
Total Downloads
License

A Laravel Nova ApexCharts Component

ApexCharts Documentation

SliderFilter in Action

Installation

You can install the package via composer:

composer require digital-creative/nova-apex-chart

Basic Usage

class ExampleNovaResource extends Resource
{

    public function cards(Request $request)
        {
    
            return [
                (new NovaApexChart())
                    ->type('bar')
                    ->series(
                        [
                            new DataOnlySeries([ 400, 430, 448, 470, 540, 580, 690, 1100, 1200, 1380 ])
                        ])
                    ->options([
                        'xaxis' => [
                            'categories' => [ 'Jan', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct' ]
                        ],
                        'tooltip' => [
                            'y' => [
                                'formatter' => new BasicFormatter('$', 'USD')
                            ]
                        ]
                    ])
            ];
        }

}

Create basic series by calling

use DigitalCreative\NovaApexChart\BasicSeries;
new BasicSeries('title', [ 400, 430, 448, 470, 540, 580, 690, 1100, 1200, 1380 ]);

Create data only series by calling

use DigitalCreative\NovaApexChart\DataOnlySeries;
new DataOnlySeries([ 400, 430, 448, 470, 540, 580, 690, 1100, 1200, 1380 ]);

Create custom formatter

use DigitalCreative\NovaApexChart\formatter\BasicFormatter;
new BasicFormatter('$', 'USD');

License

The MIT License (MIT). Please see License File for more information.