maddoger / yii2-highcharts
jQuery Highcharts 扩展,适用于 Yii 2 框架
v1.0.2
2015-10-31 22:50 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-14 18:04:18 UTC
README
Highcharts 小部件是 Highcharts(http://www.highcharts.com/)在 Yii2 框架中的封装。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist maddoger/yii2-highcharts "*"
或将以下内容添加到您的 composer.json
文件的 require 部分。
"maddoger/yii2-highcharts": "*"
用法
安装扩展后,只需在您的代码中使用即可:
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'=> [], ], ], ], ]);