PHP code example of techcyclist / highstock

1. Go to this page and download the library: Download techcyclist/highstock 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/ */

    

techcyclist / highstock example snippets

 sh
php artisan vendor:publish




namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Techcyclist\Highstock\Highstock;

class HighStockController extends Controller
{
    public function modelReturnsChart($data)
    {

        $stockchart = new Highstock();

        $modelreturnschart = $stockchart->chart([
                'type'     => 'line',
                'renderTo' => 'chartDiv',
            ])
            ->rangeSelector([
                'selected'  => 1,
            ])
            ->series(
                [
                    [
                        'name'  => 'New Chart',
                        'data'  => $data,
                        'tooltip'   => [
                            'valuedecimals' => 2,
                        ],
                    ],
                ]
            )
            ->title([
                'text' => 'New Chart',
            ])

            ->display();

        return $modelreturnschart;

    }

}

$highstockcontroller = new \App\Http\Controllers\HighStockController();
$modelreturnschart = $highstockcontroller->modelReturnsChart($data);