Assets and Widgets for easypiechart.js. See easypiechart.

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

EasyPieChart

  • content:string Content in element.
  • dataIdPrefix:string Prefix for element attribute data-chart-id.
  • element:string Element which used for easypiechar container. Default is div.
  • 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 contains pluginOptions. See usage for details.

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,
                // ...
            ],
        ],
    ],
]);

Yii2-easypiechart is under MIT licence. See the LICENSE for details.