jasonroyle/li3_highcharts
Composer 安装命令:
composer require jasonroyle/li3_highcharts
包简介
Highcharts helper for Lithium
README 文档
README
Composer
composer require jasonroyle/li3_highcharts
Git
git submodule add https://github.com/IngeniumIDS/li3_highcharts.git libraries/li3_highcharts
Enable the Library
Make the application aware of the library by adding the following to app/config/bootstrap/libraries.php.
Libraries::add('li3_highcharts');
Finally load the jQuery and highcharts JavaScript libraries between the <head> and </head> HTML tags at the top of the layout.
echo $this->html->script([ 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', 'http://code.highcharts.com/highcharts.js' ]);
Usage
The helper has seven functions that generate different types of charts (area, areaSpline, bar, column, line, pie and spline). These functions accept three parameters (title, data and options).
Parameter formatting:
- The title should either be a string or null.
- The data for the area, areaSpline, bar, column, line and spline functions is a PHP array version of the series.data JavaScript array.
- The data for the pie function is an associative array where the keys are the series names and the values are integers.
- The options is a PHP array version of the JavaScript object that would normally be passed to the highcharts JavaScript function.
Some options have been added to make a few things easier:
- Series names can be set as the keys of the data array.
- Values of the data array that aren't arrays are applied to all series as options.
- The pointStart option can be set to any PHP supported date and time format.
- The pointInterval option can be set to second, minute, hour, day or week.
Area chart:
echo $this->highcharts->area( 'Daily Page Clicks', [ 'pointStart' => '28 August 2013', 'pointInterval' => 'day', 'Home' => ['data' => [1,3,2,7,5,4,6,2]], 'Contact' => ['data' => [0,1,1,4,5,0,4,1]] ], [ 'xAxis' => ['type' => 'datetime'], 'yAxis' => ['title' => ['text' => 'Clicks']] ] );
Pie chart:
echo $this->highcharts->pie( 'Browser Share', [ 'Chrome' => 61, 'Safari' => 38, 'IE' => 6, 'Others' => 4, 'Opera' => 3 ] );
Anonymous JavaScript functions can be used.
Area spline chart:
echo $this->highcharts->areaSpline( 'Daily Page Clicks', [ 'pointStart' => '(function(){return Date.UTC(2013,7,28,0,0,0);})()', 'pointInterval' => '(function(){return 24 * 3600 * 1000;})()', 'Home' => ['data' => [1,3,2,7,5,4,6,2]], 'Contact' => ['data' => [0,1,1,4,5,0,4,1]] ], [ 'xAxis' => ['type' => 'datetime'], 'yAxis' => ['title' => ['text' => 'Clicks']] ] );
The helper has one more function (chart) which can be used with only the options parameter to allow full configuration.
Spline chart:
echo $this->highcharts->chart([ 'chart' => ['type' => 'spline'], 'title' => ['text' => 'Daily Page Clicks'], 'xAxis' => ['type' => 'datetime'], 'yAxis' => ['title' => ['text' => 'Clicks']], 'series' => [ 'pointStart' => '28 August 2013', 'pointInterval' => 'day', 'Home' => ['data' => [1,3,2,7,5,4,6,2]], 'Contact' => ['data' => [0,1,1,4,5,0,4,1]] ] ]);
jasonroyle/li3_highcharts 适用场景与选型建议
jasonroyle/li3_highcharts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 108 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 02 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jasonroyle/li3_highcharts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jasonroyle/li3_highcharts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 108
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-17