yii2mod/yii2-c3-chart

Yii2 wrapper for D3-based reusable chart library

Installs: 62 065

Dependents: 0

Suggesters: 0

Security: 0

Stars: 11

Watchers: 9

Forks: 5

Open Issues: 2

Type:yii2-extension

1.0.2 2017-03-07 16:49 UTC

This package is not auto-updated.

Last update: 2024-10-26 18:54:35 UTC


README

Yii2 Chart Widget


Yii2 wrapper for D3-based reusable chart library

Latest Stable Version Total Downloads License Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-c3-chart "*"

or add

"yii2mod/yii2-c3-chart": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?php echo \yii2mod\c3\chart\Chart::widget([
    'options' => [
            'id' => 'popularity_chart'
    ],
    'clientOptions' => [
       'data' => [
            'x' => 'x',
            'columns' => [
                ['x', 'week 1', 'week 2', 'week 3', 'week 4'],
                ['Popularity', 10, 20, 30, 50]
            ],
            'colors' => [
                'Popularity' => '#4EB269',
            ],
        ],
        'axis' => [
            'x' => [
                'label' => 'Month',
                'type' => 'category'
            ],
            'y' => [
                'label' => [
                    'text' => 'Popularity',
                    'position' => 'outer-top'
                ],
                'min' => 0,
                'max' => 100,
                'padding' => ['top' => 10, 'bottom' => 0]
            ]
        ]
    ]
]); ?>

Chart Examples

You can find them on the examples page

Chart Options

You can find them on the options page