kongoon/yii2-c3js-chart

C3JS Chart for Yii Framework 2.0

Installs: 477

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

0.0.4 2016-05-23 07:01 UTC

This package is auto-updated.

Last update: 2024-12-12 03:47:57 UTC


README

Easily add C3JS graphs to your Yii2 application.

Screen Shot

Install

The preferred way to install this extension is through composer.

Either run

composer require kongoon/yii2-c3js-chart

Usage

To use this widget, insert the following code into a view file:

use kongoon\c3js\C3JS;

echo C3JS::widget([
    'options' => [
        'data' => [
            'x' => 'x',
            'columns' => [
                ['x', '2016-01-01', '2016-02-01', '2016-03-01', '2016-04-01', '2016-05-01', '2016-06-01'],
                ['data1', 30, 200, 100, 400, 150, 250],
                ['data2', 50, 20, 10, 40, 15, 25]
            ],
            'types' => [
                'data1' => 'bar',
                'data2' => 'bar'
            ],
        ],

        'axis' => [
            'y' => [
                'label' => [
                    'text' => 'Y Label',
                    'position' => 'outer-middle',
                ]
            ],
            'x' => [
                'type' => 'timeseries',
                'tick' => [
                    'format' => '%Y-%m-%d'
                ],
                'label' => [
                    'text' => 'X Label',
                    'position' => 'outer-middle',
                ]
            ]
        ]
    ],

]);