Yii2 easypiechart
Assets and Widgets for easypiechart.js. See easypiechart.
Installation
The preferred way to install this extension is through composer.
$ composer require braunmar/yii2-easypiechart
Or add:
"braunmar/yii2-easypiechart": "*"
To the require
section of your composer.json file. Then rune:
$ composer update
Options
EasyPieChart
content
:string Content inelement
.dataIdPrefix
:string Prefix for element attributedata-chart-id
.element
:string Element which used for easypiechar container. Default isdiv
.options
:array HTML options for element.pluginOptions
:array Options for easypiechart.
EasyPieChartRegister
charts
:array Array of charts. Each item of array represent one group of easypiechart group and containspluginOptions
. See usage for details.
Usage
EasyPieChart
use braunmar\yii\easypiechart\EasyPieChart;
use yii\helpers\Html;
echo EasyPieChart::widget([
'content' => Html::tag('p', '85%'),
'element' => 'div',
'options' => ['data-percent' => 85, 'class' => 'easypiechart'],
'pluginOptions' => [
'scaleColor' => false,
'trackColor' => '#d6d6d6',
'lineWidth' => 4,
'barColor' => '#232323',
'size' => 120,
// ...
],
]);
EasyPieChartRegister
use braunmar\yii\easypiechart\EasyPieChartRegister;
EasyPieChartRegister::widget([
'charts' => [
[
'selector' => '.easy-pie-chart',
'pluginOptions' => [
'scaleColor' => false,
'trackColor' => '#d6d6d6',
'lineWidth' => 4,
'barColor' => '#232323',
'size' => 120,
// ...
],
],
],
]);
Licence
Yii2-easypiechart is under MIT licence. See the LICENSE
for details.