PHP code example of ding / laravel-echarts

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

    

ding / laravel-echarts example snippets


$chart = app('chart')->locale('ZH')
    ->addSeries([
        'name' => 'Series #1',
        'type' => 'line',
        'data' => [1, 3, 2, 2, 4, 12, 5]
    ])
    ->addSeries([
        'name' => 'Series #2',
        'type' => 'line',
        'data' => [3, 1, 3, 4, 2, 11, 3]
    ])
    ->xAxis(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'])
    ->yAxis()
    ->legend() // 自动根据 series names 设置 legend
    ->lazy(); // 懒加载


<div style="width: 500px;height:400px;">
    {!! $chart->render() !!}
</div>