mitrm / yii2-amcharts
amcharts.com 的 Yii2 扩展
dev-master
2015-02-25 00:00 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-26 04:10:45 UTC
README
要安装,请运行以下命令之一
$ php composer.phar require --prefer-dist mitrm/yii2-amcharts "dev-master"
或添加
"mitrm/yii2-amcharts": "dev-master"
示例:显示饼图
$chartConfiguration = [ 'dataProvider' => [ ['author' => 'Вася', 'title' => 'Васильев Вася', 'count' => 5], ['author' => 'Олег', 'title' => 'Васильев Олег', 'count' => 15], ], 'type' => 'pie', 'legend' => [ 'markerType' => 'circle', 'position' => 'right', 'marginRight' => 30, 'autoMargins' => false, 'labelWidth' => 310, 'labelText' => '[[title]]', 'valueText' => '[[value]] ([[percents]]%)', 'width' => 390, ], 'maxLabelWidth' => 150, 'marginLeft' => -100, 'marginTop' => 0, 'marginBottom' => 0, 'labelText' => '[[value]] ([[percents]]%)', 'valueField' => 'count', 'titleField' => 'title', 'descriptionField' => 'author', 'balloonText' => '[[title]]<br><span style=\'font-size:12px\'><b>[[value]]</b> ([[percents]]%)</span>', ]; echo mitrm\amcharts\AmChart::widget([ 'chartConfiguration' => $chartConfiguration, 'options' => ['id' => 'chart_id'], 'width' => '100%', 'language' => 'ru', ]);