khotim / yii2-highcharts
Yii 框架的 Highcharts 扩展
v1.0.0
2016-01-08 08:22 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-26 00:34:54 UTC
README
Yii2 框架的 Highcharts 库包装器。它支持渲染 Highcharts、Highstock 和 Highmaps。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一:
php composer.phar require --prefer-dist khotim/yii2-highcharts "*"
或者
"khotim/yii2-highcharts": "*"
将以下内容添加到您的 composer.json 文件的 require 部分中。
使用方法
将以下代码插入到视图文件中(使用 此示例)。
<?= \khotim\highcharts\Highcharts::widget([ 'chartType' => \khotim\highcharts\Highcharts::TYPE_HIGHCHARTS, 'options' => [ 'id' => 'myChart' ], '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' =>'Production', 'data' => [5, 7, 3] ] ] ] ]) ?>