maddoger/yii2-highcharts

jQuery Highcharts extension for the Yii 2 framework

Installs: 157

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.0.2 2015-10-31 22:50 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:56:23 UTC


README

Highcharts widget is a wrapper of Highcharts for Yii2 Framework.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist maddoger/yii2-highcharts "*"

or add

"maddoger/yii2-highcharts": "*"

to the require section of your composer.json file.

Usage

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

use maddoger\widgets\Highcharts;

echo Highcharts::widget([
        'chartVariable' => 'cpuChart',
        'options' => [
            'style' => 'width: 100%; height: 400px;',
        ],
        'clientOptions' => [
            'chart' => [
                'type' => 'line',
            ],
            'title' => [
                'text' => 'CPU Usage',
            ],
            'xAxis' => [
                'type' => 'datetime',
                'tickPixelInterval' => 150,
                'maxZoom' => 20 * 2000,
            ],
            'yAxis' => [
                'min' => 0,
                'max' => 100,
                'title' => [
                    'text' => '%',
                ],
            ],
            'series' => [
                [
                    'name'=> 'Core 1',
                    'data'=> [],
                ],
                [
                    'name'=> 'Core 2',
                    'data'=> [],
                ],
            ],
        ],
    ]);