skeeks/yii2-widget-highcharts
Composer 安装命令:
composer require skeeks/yii2-widget-highcharts
包简介
Highcharts widget for Yii 2 Framework.
README 文档
README
Easily add Highcharts, Highstock and Highmaps graphs to your Yii2 application.
About
Highcharts
Create interactive charts easily for your web projects. Used by tens of thousands of developers and 59 out of the world's 100 largest companies, Highcharts is the simplest yet most flexible charting API on the market.
Highstock
Highstock lets you create stock or general timeline charts in pure JavaScript. Including sophisticated navigation options like a small navigator series, preset date ranges, date picker, scrolling and panning.
Highmaps
Build interactive maps to display sales, election results or any other information linked to geography. Perfect for standalone use or in dashboards in combination with Highcharts!
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist skeeks/yii2-widget-highcharts "dev-master"
or add
"skeeks/yii2-widget-highcharts": "dev-master"
to the require section of your composer.json file.
Usage
Preferred Method (using PHP arrays)
To use this widget, insert the following code into a view file:
use skeeks\widget\highcharts\Highcharts; echo Highcharts::widget([ 'options' => [ 'title' => ['text' => 'Fruit Consumption'], 'xAxis' => [ 'categories' => ['Apples', 'Bananas', 'Oranges'] ], 'yAxis' => [ 'title' => ['text' => 'Fruit eaten'] ], 'series' => [ ['name' => 'Jane', 'data' => [1, 0, 4]], ['name' => 'John', 'data' => [5, 7, 3]] ] ] ]);
By configuring the options property, you can specify the options that need to be passed to the Highcharts JavaScript object. Please refer to the demo gallery and documentation on the Highcharts website for possible options.
See /doc/examples for more usage examples.
Alternative Method (using JSON string)
Alternatively, you can use a valid JSON string in place of an associative array to specify options:
Highcharts::widget([ 'options'=>'{ "title": { "text": "Fruit Consumption" }, "xAxis": { "categories": ["Apples", "Bananas", "Oranges"] }, "yAxis": { "title": { "text": "Fruit eaten" } }, "series": [ { "name": "Jane", "data": [1, 0, 4] }, { "name": "John", "data": [5, 7,3] } ] }' ]);
Note: You must provide a valid JSON string (with double quotes) when using the second option. You can quickly validate your JSON string online using JSONLint.
Just the Assets
If you merely want to include the Highcharts/Highstock/Highmaps javascript libraries in your view, you can bypass the widget and access the asset bundle directly:
use skeeks\widget\highcharts\HighchartsAsset; HighchartsAsset::register($this)->withScripts(['highstock', 'modules/exporting', 'modules/drilldown']);
In this scenario, you would need to write and include your own JavaScript to display the charts, just as illustrated in the Highcharts Demo, Highstock Demo and Highmaps Demo pages.
Tips
-
If you need to use JavaScript in any of your configuration options, use Yii's [[JsExpression]] object. For instance:
... 'tooltip' => [ 'formatter' => new JsExpression('function(){ return this.series.name; }') ], ...
Note, this is currently only possible when using a PHP associative array (Preferred Method) for configuration.
-
Highcharts by default displays a small credits label in the lower right corner of the chart. This can be removed using the following top-level option.
... 'credits' => ['enabled' => false], ...
-
All adapters, modules, themes, and supplementary chart types must be enabled through the top-level 'scripts' option.
... 'scripts' => [ 'highcharts-more', // enables supplementary chart types (gauge, arearange, columnrange, etc.) 'modules/exporting', // adds Exporting button/menu to chart 'themes/grid' // applies global 'grid' theme to all charts ], ...
For a list of available scripts, see the contents of
vendor/skeeks/yii2-widget-highcharts/assets/.
Web development has never been so fun!
www.skeeks.com
skeeks/yii2-widget-highcharts 适用场景与选型建议
skeeks/yii2-widget-highcharts 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 30.84k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「extension」 「highcharts」 「widget」 「yii2」 「highstock」 「highmaps」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 skeeks/yii2-widget-highcharts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 skeeks/yii2-widget-highcharts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 skeeks/yii2-widget-highcharts 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
Yii2 asset collection of useful JavaScript libraries
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Symfony Bundle that ease the use of highcharts to display rich graph and charts in your application.
Export highcharts from PHP without running the NodeJS export server
统计信息
- 总下载量: 30.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2014-10-30