All Projects → fidum → Laravel Dashboard Chart Tile

fidum / Laravel Dashboard Chart Tile

Licence: mit
Create all the charts you want for your laravel dashboard

Projects that are alternatives of or similar to Laravel Dashboard Chart Tile

Coreui Free Laravel Admin Template
CoreUI Free Laravel Bootstrap Admin Template
Stars: ✭ 353 (+246.08%)
Mutual labels:  laravel, laravel-framework, dashboard
Laravel Ecommerce Iyzico
Iyzico intigrated e-Commerce system that could be developed easily in simple level.
Stars: ✭ 81 (-20.59%)
Mutual labels:  laravel, laravel-framework
Brandenburg
Laravel Authentication Package
Stars: ✭ 79 (-22.55%)
Mutual labels:  laravel, laravel-framework
Laravel Verify New Email
This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.
Stars: ✭ 90 (-11.76%)
Mutual labels:  laravel, laravel-framework
Laraupdater
Enable Laravel App Self-Update. Allow your Laravel Application to auto-update itself.
Stars: ✭ 75 (-26.47%)
Mutual labels:  laravel, laravel-framework
Laravel 5 Messenger
A Simple Laravel 5, 6, 7 & 8 Messenger with Pusher Capabilities
Stars: ✭ 75 (-26.47%)
Mutual labels:  laravel, laravel-framework
Blog System In Laravel
Complete Blog System in Laravel
Stars: ✭ 89 (-12.75%)
Mutual labels:  laravel, laravel-framework
Vmdash
A Cloud (vm) Dashboard that allows you to interact with multiple providers from a single panel
Stars: ✭ 71 (-30.39%)
Mutual labels:  laravel, dashboard
Laravel Analytics
Analytics for the Laravel framework.
Stars: ✭ 91 (-10.78%)
Mutual labels:  laravel, dashboard
Forsun Laravel
高性能的定时调度服务。
Stars: ✭ 91 (-10.78%)
Mutual labels:  laravel, laravel-framework
Dropzone Laravel Image Upload
Laravel 5.2 and Dropzone.js auto image uploads with removal links
Stars: ✭ 92 (-9.8%)
Mutual labels:  laravel, laravel-framework
Pingcrm Svelte
🦊 Ping CRM Svelte - A demo app to illustrate how Inertia.js works with Laravel and Svelte (hosted on a heroku free dyno).
Stars: ✭ 74 (-27.45%)
Mutual labels:  laravel, laravel-framework
Sing App
💥Free and open-source admin dashboard template built with Bootstrap 4.5 💥
Stars: ✭ 1,187 (+1063.73%)
Mutual labels:  chart, dashboard
Laravel Schedulable
Schedule and unschedule eloquent models elegantly without cron jobs
Stars: ✭ 78 (-23.53%)
Mutual labels:  laravel, laravel-framework
Gtrader
a trading strategy trainer, back-tester and bot
Stars: ✭ 71 (-30.39%)
Mutual labels:  laravel, laravel-framework
Tall Dashboard
Tailwind CSS + AlpineJS + Laravel + Livewire dashboard (WIP)
Stars: ✭ 83 (-18.63%)
Mutual labels:  laravel, dashboard
Thumbnail
Thumbnail for a given video using FFMpeg
Stars: ✭ 96 (-5.88%)
Mutual labels:  laravel, laravel-framework
Laravel Potion
laravel - Potion is a pure PHP asset manager for Laravel 5 based off of Assetic.
Stars: ✭ 63 (-38.24%)
Mutual labels:  laravel, laravel-framework
Backup
MySQL Database backup package for Laravel
Stars: ✭ 66 (-35.29%)
Mutual labels:  laravel, laravel-framework
Laravel Totem
Manage Your Laravel Schedule From A Web Dashboard
Stars: ✭ 1,299 (+1173.53%)
Mutual labels:  laravel, dashboard

Laravel Dashboard Charting Tile

Latest Version on Packagist GitHub Tests Action Status Codecov Twitter Follow

Show off your charting skills with this easy to use tile. Supports line, bar, pie, doughnut and many more!

Preview

This tile uses the Laravel Charts to build the charts and by default renders the charts using Chart.js.

Laravel Charts is built on top of a framework agnostic package called Chartisan which allows you to choose which frontend charting library you want to use.

If you want to use a different chart library from the default then just set the appropriate script urls in the dashboard.tiles.charts.scripts config described below in the Usage section.

Installation

You can install the package via composer:

composer require fidum/laravel-dashboard-chart-tile

Usage

In the dashboard config file, you can optionally add this configuration in the tiles key.

// in config/dashboard.php
return [
    // ...
    'tiles' => [
        'charts' => [     
            'refresh_interval_in_seconds' => 300, // Default: 300 seconds (5 minutes)
            'scripts' => [     
                'chart' => 'https://unpkg.com/[email protected]/dist/Chart.min.js',
                'chartisan' => 'https://unpkg.com/@chartisan/[email protected]*/dist/chartisan_chartjs.umd.js', 
                'moment' => 'https://unpkg.com/[email protected]/min/moment-with-locales.min.js',
            ],
        ],
    ],
];

So that you can easily add your datasets and configure your charts exactly how you want them you need to create a chart class that extends the Fidum\ChartTile\Charts\Chart abstract class.

See chart example below:

namespace App\Charts;

use Carbon\Carbon;
use Chartisan\PHP\Chartisan;
use Fidum\ChartTile\Charts\Chart;
use Illuminate\Http\Request;

class DailyUsersChart extends Chart
{
    public function handler(Request $request): Chartisan
    {
        $date = Carbon::now()->subMonth()->startOfDay();

        $data = collect(range(0, 12))->map(function ($days) use ($date) {
            return [
                'x' => $date->clone()->addDays($days)->toDateString(),
                'y' => rand(100, 500),
            ];
        });

        return Chartisan::build()
            ->labels($data->pluck('x')->toArray())
            ->dataset('Example Data', $data->toArray());
    }

    public function type(): string
    {
        return 'bar';
    }

    public function options(): array
    {
        return [
            'responsive' => true,
            'maintainAspectRatio' => false,
            // etc ...
        ];
    }
}

Then you must register the chart in your AppServiceProvider::boot method. See Laravel Charts > Register the chart for more information:

app(ConsoleTVs\Charts\Registrar::class)->register([
    App\Charts\DailyUsersChart::class
]);

In your dashboard view you can use the below component as many times as needed. Pass your chart class reference to the component and that will be used to generate the chart.

<x-dashboard>
    <livewire:chart-tile chartClass="{{App\Charts\DailyUsersChart::class}}" position="a1:a3" />
</x-dashboard>

Optional properties:

  • chartFilters optional key value array of settings that is passed to the request and can be accessed using the Request class passed to your charts handler method. Only use this for passing simple values strings, integers, arrays etc. To use this you will have to use @livewire syntax over the component syntax in order set the array value.
@livewire('chart-tile', [
    'chartClass' => App\Charts\DailyUsersChart::class, 
    'chartFilters' => ['type' => 'customer'],
])
  • height sets the height of the chart, depending on your dashboard layout you may need to adjust this (defaults to 100%).

  • refreshIntervalInSeconds use this to override the refresh rate of an individual tile (defaults to 300 seconds)

Examples

We have provided some example charts to help get you started here. These are configured to render chart.js charts only.

If you would like to use them don't forget to register them in your AppServiceProvider::boot method:

app(ConsoleTVs\Charts\Registrar::class)->register([
    Fidum\ChartTile\Examples\ExampleBarChart::class,
    Fidum\ChartTile\Examples\ExampleLineChart::class,
    Fidum\ChartTile\Examples\ExamplePieChart::class,
    Fidum\ChartTile\Examples\ExampleDoughnutChart::class,
]);

You can use the below dashboard layout to have an instant showcase of these examples:

<x-dashboard>
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExamplePieChart::class}}" position="a1:a2" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleDoughnutChart::class}}" position="b1:b2" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExamplePieChart::class}}" position="c1:c2" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleDoughnutChart::class}}" position="d1:d2" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleBarChart::class}}" position="a3:b4" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleLineChart::class}}" position="c3:d4" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleLineChart::class}}" position="a5:b6" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleBarChart::class}}" position="c5:d6" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleBarChart::class}}" position="a7:b8" />
    <livewire:chart-tile chartClass="{{\Fidum\ChartTile\Examples\ExampleLineChart::class}}" position="c7:d8" />
</x-dashboard>

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker.

Credits

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].