PHP code example of yyxx9988 / yii2echarts

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

    

yyxx9988 / yii2echarts example snippets


use yyxx9988\yii2echarts\ECharts;

$echarts = new ECharts();

$result = $echarts->setTableName('test_tb')
    ->setFields([
        [
            'name' => 'f1',
            'titleText' => 'f1 titleText',
            'titleSub' => 'f1 titleSub',
            'seriesName' => 'f1 seriesName',
        ],
        [
            'name' => 'f2',
            'titleText' => 'f2 titleText',
            'titleSub' => 'f2 titleSub',
            'seriesName' => 'f2 seriesName',
        ],
    ])
    ->generatePie();

echo json_encode($result);