hscstudio / yii2-chart
基于 ChartNewJs 的 Yii 2.0 图表扩展
1.0.0
2015-06-18 02:58 UTC
This package is auto-updated.
Last update: 2024-09-25 20:32:57 UTC
README
基于 ChartNewJs 的 Yii 2.0 图表扩展
什么是 ChartNewJs?? 它是从 https://github.com/FVANCOP/ChartNew.js/ 的图表库,该库在 https://github.com/nnnick/Chart.js/ 的基础上进行了改进,增加了许多新特性
安装
通过 composer 安装此扩展是首选方式。
运行以下命令:
php composer.phar require --prefer-dist hscstudio/yii2-chart "~1.0"
或者
"hscstudio/yii2-chart": "~1.0"
将以下内容添加到您的 composer.json
文件的 require 部分中。
使用方法
扩展安装完成后,您只需在代码中按以下方式使用它:
<?= \hscstudio\chart\Chart::widget(); ?>
或
<?php use hscstudio\chart\ChartNew; echo ChartNew::widget([ 'type'=>'bar', # pie, doughnut, line, bar, horizontalBar, radar, polar, stackedBar, polarArea 'title'=>'PHP Framework', 'labels'=>['Yii','Laravel','CI','Symfony'], 'datasets' => [ ['title'=>'2014','data'=>[35,45,15,5]], ['title'=>'2015','data'=>[45,35,5,15]], ], ]); ?>