What is HighCharts Widget?
This widget allows you to make use of the HighCharts JS plugin in your Yii 2 applications with ease.
The preferred way to install this extension is through composer.
php composer.phar require 2amigos/yii2-highcharts-widget:~1.0
or add the following to the require section of your application's
"2amigos/yii2-highcharts-widget" : "~1.0"
The following is a demo code using a "Bar" type chart. For more information about the different types available, please visit HighCharts site.
<?php use dosamigos\highcharts\HighCharts; ?> <?= HighCharts::widget([ 'clientOptions' => [ 'chart' => [ 'type' => 'bar' ], 'title' => [ 'text' => 'Fruit Consumption' ], 'xAxis' => [ 'categories' => [ 'Apples', 'Bananas', 'Oranges' ] ], 'yAxis' => [ 'title' => [ 'text' => 'Fruit eaten' ] ], 'series' => [ ['name' => 'Jane', 'data' => [1, 0, 4]], ['name' => 'John', 'data' => [5, 7, 3]] ] ] ]); // [...]