muvo/yii2-amcharts

Yii2 的 amCharts 小部件

安装次数: 2,690

依赖关系: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

公开问题: 0

类型:yii2-extension

dev-master 2016-05-03 00:00 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:20:00 UTC


README

安装

案例 #1

~ $ composer require muvo/yii2-amcharts

案例 #2

或者在您的 composer.json 文件的 require 部分添加此字符串

"muvo/yii2-charts" : "*"

然后运行

~ $ composer update

用法

在您的 视图 文件中,您可以将图表作为常规小部件添加,例如

<h1>Age Graph</h1>
<?= \muvo\yii\amcharts\Chart::widget([
    'options' => [ // Here is HTML-parameters of DIV element, which contain chart
        'style' => 'height:120px; width: 320px;',
    ],
    'chart' => [ // Here parameters for AmCharts.makeChart()
        'type' => 'serial',
        'categoryField' => 'name',
        'graphs' => [
            [
                'title' => 'Age',
                'type' => 'column',
                'valueField' => 'age',
                'fillAlphas' => 0.75,
            ],
        ],
        'dataProvider' => [
            [
                'name' => 'Alice',
                'age' => 19,
            ],
            [
                'name' => 'Bob',
                'age' => 21,
            ],
            [
                'name' => 'Claire',
                'age' => 35,
            ],
        ],
    ],
]) ?>

另请参阅

amCharts 官方 API 参考文档

致谢

Владислав Мушинский i@unixoid.su © 2016