yiier / yii2-chartjs-widget
Yii2的ChartJs 2小部件
v1.3
2018-05-04 06:47 UTC
Requires
- bower-asset/chart.js: ^2.1.3
- yiisoft/yii2: *
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] ] ] ] ]);?>