Highcharts
use miloschuman\highcharts\Highcharts; use yii\web\JsExpression; $this->registerAssetBundle('yii\web\YiiAsset'); echo Highcharts::widget([ 'options' => [ 'title' => ['text' => 'Статистика за месяц'], 'xAxis' => [ 'categories' => array_keys($statistic) ], 'yAxis' => [ 'title' => ['text' => 'Достижения цели'] ], 'series' => [ ['name' => 'Jane', 'data' => array_values($statistic), 'class'=>'test-class'], ], 'plotOptions' => [ 'series' => [ 'cursor' => 'pointer', 'point' => [ 'events' => [ 'click' => new JsExpression('function(e){ alert(this.x); }') ] ] ] ] ] ]);
Документация / Примеры
Flotcharts
use borodulin/yii2-flot
use conquer\flot\FlotWidget; echo FlotWidget::widget([ 'htmlOptions'=>['class'=>'chart'], 'data'=>[ ['labels'=>'Unique Visits', 'data'=>array_map(function($v){return [$v, rand(10,50)];}, range(1, 30))], ['labels'=>'Page Views', 'data'=>array_map(function($v){return [$v, rand(10,50)];}, range(1, 30))], ], 'options'=>[ 'series'=>[ 'lines'=> [ 'show'=> true, 'lineWidth'=> 2, 'fill'=> true, 'fillColor'=> ['colors'=> [ ['opacity'=>0.05], ['opacity'=>0.01], ]], ], 'points'=>['show'=>true], 'shadowSize'=> 2, ], 'grid'=> [ 'hoverable'=> true, 'clickable'=> true, 'tickColor'=> "#eee", 'borderWidth'=> 0, ], 'colors'=> ["#d12610", "#37b7f3", "#52e136"], 'xaxis' => [ 'ticks'=> 11, 'tickDecimals'=> 0, ], 'yaxis'=> [ 'ticks'=> 11, 'tickDecimals'=> 0, ] ], ]);