There is no license information available for the latest version (dev-main) of this package.

Advanced charts for laravel

dev-main 2022-08-13 01:41 UTC

This package is auto-updated.

Last update: 2025-07-24 23:56:58 UTC


README

License: MIT Chartron Usage Model

About Chartron

Chartron is a PHP library with elegant syntax. The easiest way to setup your dataset.

If you are using the Laravel framework i highly recommend the usage of chartron-routes

Example usage

This example code generates the dataset for the graph above.

//declare the library
use Chartron\APP\Chartron;

//build and configurations
$chartron = Chartron::build();
$chartron->monthLabels("EN");
    
//chart customization options
$options1 = ["backgroundColor"=>"#F20000"];
$options2 = ["backgroundColor"=>"#10A774"];
    
//set chartron datasets
$chartron->dataset("Team",[4,2,1,4,3,1,2,5,7,3,1,3],$options1);
$chartron->dataset('User',[1,2,7,6,4,5,1,5,7,1,2,5],$options2);
    
//return the json data object
return $chartron->keep();

Instalation

composer require chartron/app

First Steps

First initiate the cartron object

$chartron = Chartron::build();

Setup the chart label

$chartron->labels(["First","Second","Third"]);

Setup the dataset

$chartron->dataset("Users",[4,2,1]);

Then use the method keep to generate the JSON object;

$chartron->keep();

Options

Inside the option field you have the possibily to customtize with whenever you want based in the front end library chart you are using.

$options = ["backgroundColor"=>"#F20000"];

In this example i'm using Chart JS so i set the backgroundColor to #F20000 according to the Chart JS documentation

License

MIT License