2017 © Pedro Peláez
 

yii2-extension yii2-echarts

Chart widgets for Yii2

image

peterziv/yii2-echarts

Chart widgets for Yii2

  • Thursday, June 15, 2017
  • by peterziv
  • Repository
  • 1 Watchers
  • 0 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

yii2-echarts

This is the Yii2 widgets for echarts. You can use this widget to implement the all charts supported by echarts. Some quick class for Line,Pie and map implement. Echarts, (*1)

You can get detail of echarts from echarts official website :), (*2)

安装 (Installation):

$ composer require "peterziv/yii2-echarts:dev-master"

示例 (Demo):

Pie Chart, (*3)

$pieData = ['n1' => ['value' => 11.1], 'n2' => ['value' => 22.2]];
echo Pie::widget([
    'title'=>'Pie Chart Test',
    'responsive' => true,
    'htmlOptions' => ['style' => 'height: 300px;'],
    'visualMap' => [
        "show" => false,
        "min" => 80,
        "max" => 600
    ],
    'data' => $pieData
]);

Line Chart, (*4)

$lineData = ['serie1' => ['value' => [1, 2, 3], 'averageLine' => true, 'maxPoint' => true, 'minPoint' => true], 'serie2' => ['averageLine' => true, 'value' => [3, 6, 9]]];
echo Line::widget([
    'responsive' => true,
    'htmlOptions' => ['style' => 'height: 300px;'],
    'title' => 'Line Chart Test',
    'unit'=>'度',
    'axis'=>['小','中','大'],
    'data'=>$lineData
]);

Zero data support, (*5)

$zero =[];
echo Line::widget([
  'htmlOptions' => ['style' => 'height: 300px;'],
  'responsive' => true,
  'title' => 'No Data Test',
  'unit' => '度',
  'axis' => ['小', '中', '大'],
  'data' => $zero
]);

Also Support json and custom, (*6)

$theOptions =  '{
    "title": {
        "text": "Json data Support"
    },
    "legend": {
        "data": ["bar1", "bar2"],
        "align": "left"
    },
    "toolbox": {
        "feature": {
            "magicType": {
                "type": ["stack", "tiled"]
            }
        }
    },
    "yAxis":[{"name":"SCORE","type":"value"}],
    "xAxis": {
        "data": ["测试1", "测试2", "测试3", "测试4"],
        "silent": false,
        "splitLine": {
            "show": false
        }
    },
    "series": [{
        "name": "bar1",
        "type": "bar",
        "data": [1, 2, 5, 8]
    }, {
        "name": "bar2",
        "type": "bar",
        "data": [9, 6, 5, 8]
    }]
}';
echo Echarts::widget([
  'options'=>$theOptions,
  'htmlOptions' => ['style' => 'height: 300px;'],
]);

The Versions

15/06 2017

dev-master

9999999-dev

Chart widgets for Yii2

  Sources   Download

MIT

by peter.ziv

extension yii2 widget chart