yii2mod / yii2-c3-chart
基于D3的可重用图表库的Yii2包装器
1.0.2
2017-03-07 16:49 UTC
Requires
- bower-asset/c3: *
- yiisoft/yii2: *
- yiisoft/yii2-bootstrap: *
Requires (Dev)
This package is not auto-updated.
Last update: 2024-09-14 18:20:22 UTC
README
Yii2图表小部件
基于D3的可重用图表库的Yii2包装器
安装
安装此扩展的首选方式是通过 composer。
运行以下命令:
php composer.phar require --prefer-dist yii2mod/yii2-c3-chart "*"
或者在您的 composer.json
文件的require部分添加以下内容:
"yii2mod/yii2-c3-chart": "*"
使用方法
扩展安装完成后,您可以在代码中通过以下方式使用它:
<?php echo \yii2mod\c3\chart\Chart::widget([ 'options' => [ 'id' => 'popularity_chart' ], 'clientOptions' => [ 'data' => [ 'x' => 'x', 'columns' => [ ['x', 'week 1', 'week 2', 'week 3', 'week 4'], ['Popularity', 10, 20, 30, 50] ], 'colors' => [ 'Popularity' => '#4EB269', ], ], 'axis' => [ 'x' => [ 'label' => 'Month', 'type' => 'category' ], 'y' => [ 'label' => [ 'text' => 'Popularity', 'position' => 'outer-top' ], 'min' => 0, 'max' => 100, 'padding' => ['top' => 10, 'bottom' => 0] ] ] ] ]); ?>
图表示例
您可以在 示例页面 上找到它们
图表选项
您可以在 选项页面 上找到它们