code-works/yii-c3js

Yii 框架的 c2.js 适配器

安装次数: 13

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

语言:JavaScript

v1.0.0 2016-06-26 16:32 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:47:44 UTC


README

Latest Stable Version Total Downloads License Scrutinizer Code Quality

轻松将 C3.js 图表添加到您的 Yii 应用程序中。

链接

要求

  • Yii 1.1.5 或更高版本
  • PHP 5.1 或更高版本

安装

  • protected/extensions/ 下提取发行文件

使用方法

要使用此小部件,您可以在视图文件中插入以下代码

$this->Widget('ext.c3js.C3JsWidget', array(
    'options' => array(
        'title' => array(
            'text' => "My Chart"
        ),
        'data' => array(
            'columns' => array(
                array('data1', 30, 200, 100, 400, 150, 250)
            ),
        )
    )
));
?>

通过配置 options 属性,您可以指定需要传递给 C3.js JavaScript 对象的选项。请参考演示图库和 C3.js 网站 上的文档,以获取可能的选项。

或者,您可以使用有效的 JSON 字符串代替关联数组来指定选项


*Note:* You must provide a *valid* JSON string (double quotes) when using the second option. 
You can quickly validate your JSON string online using [JSONLint](http://jsonlint.com/).