muvo/yii2-amcharts

amCharts widget for Yii2

Installs: 2 608

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

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

This package is not auto-updated.

Last update: 2024-04-27 17:25:58 UTC


README

Install

Case #1

~ $ composer require muvo/yii2-amcharts

Case #2

or add this string into require section of your composer.json file:

"muvo/yii2-charts" : "*"

then run

~ $ composer update

Usage

In your view file you can add chart as regular widget, like:

<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,
            ],
        ],
    ],
]) ?>

See also

amCharts official API reference

Credits

Vladislav Muschinskikh i@unixoid.su © 2016