PHP code example of vemcogroup / nova-charts

1. Go to this page and download the library: Download vemcogroup/nova-charts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vemcogroup / nova-charts example snippets


use Vemcogroup\Charts\Traits\HasChartData;

class Product extends Model 
{
    use HasChartData;
    ... 
}

public function chartResourceData($selection)
{
    return [
        'labels' => [],
        'datasets' => [],
    ];
}

public function chartDashboardData($selection)
{
    return $this->chartResourceData($selection);
}

return [
    (new \Vemcogroup\Charts\Chart)->onlyOnDetail()
];

(new \Vemcogroup\Charts\Chart())->title('Title of card');

(new \Vemcogroup\Charts\Chart())->description('Description of card');

\Vemcogroup\Charts\Chart::CHART_TYPE_BAR = 'bar';
\Vemcogroup\Charts\Chart::CHART_TYPE_STACKED_BAR = 'stackedBar';
\Vemcogroup\Charts\Chart::CHART_TYPE_LINE = 'line';

(new \Vemcogroup\Charts\Chart())->type(\Vemcogroup\Charts\Chart::CHART_TYPE_BAR);

(new \Vemcogroup\Charts\Chart())->withoutLabels();

(new \Vemcogroup\Charts\Chart())->withoutLegends();

(new \Vemcogroup\Charts\Chart())->selections([2018, 2019, 2020, 2021, 2022]);

(new \Vemcogroup\Charts\Chart())->startFromSelection(2019);

(new \Vemcogroup\Charts\Chart())->model(\App\Company::class)

(new \Vemcogroup\Charts\Chart())->resource('companies');