What is HighCharts Widget?
This widget allows you to make use of the HighCharts JS plugin in your Yii 2 applications with ease.
You may already know but is worth mentioning here again that HighCharts JS is one of the best HTML5/Javascript charting libraries on the web. Is important to mention that HighCharts JS is free for a non-commercial project but not if you are developing a commercial product. Please, visit its license pricing section for more information regarding this matter.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require 2amigos/yii2-highcharts-widget:~1.0
or add the following to the require section of your application's composer.json
file:
"2amigos/yii2-highcharts-widget" : "~1.0"
Usage example
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]]
]
]
]);
// [...]