PHP code example of reedware / nova-gantt-metric

1. Go to this page and download the library: Download reedware/nova-gantt-metric 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/ */

    

reedware / nova-gantt-metric example snippets




namespace App\Nova\Metrics;

use Illuminate\Http\Request;
use Reedware\NovaGanttMetric\Gantt;

class MyExampleGantt extends Gantt
{
    /**
     * The element's component.
     *
     * @var string
     */
    public $component = 'gantt-metric';

    /**
     * The displayable name of the metric.
     *
     * @var string
     */
    public $name = 'Estimated Completion Date';

    /**
     * Calculate the value of the metric.
     *
     * @param  \Illuminate\Http\Request  $request
     *
     * @return mixed
     */
    public function calculate(Request $request)
    {
        $query = /* ... */;

        // This will group by the "label_name" column, and use the min
        // and max of the "date_column" values to create the chart
        // data. See Gantt@aggregate for additional features.

        return $this->spreadByDays($request, $query, 'label_name', 'date_column');
    }

    /**
     * Get the ranges available for the metric.
     *
     * @return array
     */
    public function ranges()
    {
        return [
            90 => 'Next 90 Days',
            180 => 'Next 180 Days',
            270 => 'Next 270 Days'
        ];
    }
}