yiiworld / yii2-chartjs-widget

ChartJs From Nick Downie Yii2 widget

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChartJs Widget

Renders a ChartJs plugin widget

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require 2amigos/yii2-chartjs-widget "*"

or add

"2amigos/yii2-chartjs-widget" : "*"

to the require section of your application's composer.json file.

Usage

Using a model:

use dosamigos\chartjs\Chart;

<?= Chart::widget([
    'type' => 'Line',
    'options' => [
        'height' => 400,
        'width' => 400
    ],
    'data' => [
        'labels' => ["January", "February", "March", "April", "May", "June", "July"],
        'datasets' => [
            [
                'fillColor' => "rgba(220,220,220,0.5)",
                'strokeColor' => "rgba(220,220,220,1)",
                'pointColor' => "rgba(220,220,220,1)",
                'pointStrokeColor' => "#fff",
                'data' => [65, 59, 90, 81, 56, 55, 40]
            ],
            [
                'fillColor' => "rgba(151,187,205,0.5)",
                'strokeColor' => "rgba(151,187,205,1)",
                'pointColor' => "rgba(151,187,205,1)",
                'pointStrokeColor' => "#fff",
                'data' => [28, 48, 40, 19, 96, 27, 100]
            ]
        ]
    ]
]);
?>

ChartJs has lots of configuration options. For further information, please check the ChartJs plugin website.

2amigOS!
Web development has never been so fun!
www.2amigos.us

About

ChartJs From Nick Downie Yii2 widget


Languages

Language:PHP 100.0%