yiier/yii2-chartjs-widget

Yii2的ChartJs 2小部件

安装数量: 7,816

依赖: 0

建议: 0

安全性: 0

星标: 2

关注者: 2

分支: 1

开放问题: 0

类型:yii2-extension

v1.3 2018-05-04 06:47 UTC

This package is auto-updated.

Last update: 2024-09-25 23:16:00 UTC


README

为Yii2小部件的ChartJs 2

安装

安装此扩展的首选方式是通过composer

运行以下命令之一

php composer.phar require --prefer-dist yiier/yii2-chartjs-widget "*"

或将以下内容添加到您的composer.json文件的require部分。

"yiier/yii2-chartjs-widget": "*"

使用方法

安装扩展后,只需在您的代码中通过以下方式使用它

<?= ChartJs::widget([
    'type' => 'line',
    'options' => [
        'height' => 200,
        'width' => 600
    ],
    'data' => [
        'labels' => ["January", "February", "March", "April", "May", "June", "July"],
         'datasets' => [
             [
                 'label'=> '# of Votes',
                 'data' => [65, 59, 90, 81, 56, 55, 40]
             ],
             [
                 'label'=> '# of Votes',
                 'data' => [28, 48, 40, 19, 96, 27, 100]
             ]
         ]
    ]
]);?>

致谢

2amigos/yii2-chartjs-widget