Laravel Charting Package

Laravel Charting Package

Creating charts is often a pain because of how you have to convert your data into what the charting library supports and each library is different.

To help make this easier Erik Campobadal created a new Laravel chart package to create interactive charts. It supports a dozen of the most popular charting libraries from standard line and bar charts, to real time charting libraries.

To create your own chart it uses a familiar fluent syntax

Charts::multi('line', 'highcharts')
    ->setColors(['#ff0000', '#00ff00', '#0000ff'])
    ->setLabels(['One', 'Two', 'Three'])
    ->setDataset('Test 1', [1,2,3])
    ->setDataset('Test 2', [0,6,0])
    ->setDataset('Test 3', [3,4,1]);

Plus you can also create charts directly from your database:

$chart = Charts::database(User::all(), 'bar', 'highcharts')
    ->setElementLabel("Total")
    ->setDimensions(1000, 500)
    ->setResponsive(false)
    ->groupByDay();

Real time charts can be setup like this:

$chart = Charts::realtime(url('/path/to/json'), 1000, 'area', 'highcharts')
            ->setResponsive(false)
            ->setHeight(300)
            ->setWidth(0)
            ->setTitle("Permissions Chart")
            ->setMaxValues(10);

For more information check out the official GitHub repo or watch the tutorial video:

This charting library supports a ton of options and seems to be really powerful for all your charting needs.


Filed in: Laravel Packages / Charts


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

SENIOR FULL STACK SOFTWARE ENGINEER
Fort Worth, Texas
Filmsupply
PHP Web Developer
Orlando, FL
Christ for all Nations
PHP Developer
Manhattan, KS (open to Remote)
CivicPlus
Mid-Senior Laravel Developer
Exeter
Optix Solutions
Full Stack Web Developer
Las Vegas, NV
V Shred
Staff Software Engineer (Laravel)
Remote
smartbnb
Software Engineer (PHP, Laravel, Vue)
Los Angeles, CA
Relocity