yii-highcharts

Highcharts Adapter for Yii Framework

  • 所有者: miloschuman/yii-highcharts
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Yii Highcharts Widget

Latest Stable Version
Total Downloads
License
Scrutinizer Code Quality

Easily add Highcharts, Highstock and Highmaps graphs to your Yii application.

Screen Shot

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!

Note: Highcharts is free for non-commercial use only. For more information, please visit the Highcharts License and Pricing page.

Requirements

  • Yii 1.1.5 or above
  • PHP 5.1 or above

Installation

  • Extract the release file under protected/extensions/

Usage

To use this widget, you may insert the following code into a view file:

$this->Widget('ext.highcharts.HighchartsWidget', array(
   'options'=>array(
      'title' => array('text' => 'Fruit Consumption'),
      'xAxis' => array(
         'categories' => array('Apples', 'Bananas', 'Oranges')
      ),
      'yAxis' => array(
         'title' => array('text' => 'Fruit eaten')
      ),
      'series' => array(
         array('name' => 'Jane', 'data' => array(1, 0, 4)),
         array('name' => 'John', 'data' => array(5, 7, 3))
      )
   )
));

By configuring the options property, you may 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.

Alternatively, you can use a valid JSON string in place of an associative array to specify options:

$this->Widget('ext.highcharts.HighchartsWidget', array(
   '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 (double quotes) when using the second option. You can quickly validate your JSON string online using JSONLint.

See /doc/examples for more usage examples.

Tips

  • If you need to use JavaScript in any of your configuration options, use the js: prefix. For instance:

    ...
    'tooltip' => array(
         'formatter' => 'js:function(){ return this.series.name; }'
    ),
    ...
    
  • 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' => array('enabled' => false),
    ...
    
  • Since version 3.0.2, all adapters, modules, themes, and supplementary chart types must be enabled through the top-level 'scripts' option.

    ...
    'scripts' => array(
         '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
    ),
    ...
    

    Previous versions relied on auto-detection magic, but that became less reliable as Highcharts evolved. The new method
    more accurately follows the native process of including/excluding additional script files and gives the user some finer-grain control.
    For a list of available scripts, see the contents of protected/extensions/highcharts/assets/.

  • You can access the JavaScript chart object from another script like this:

    var chart = $('#my-chart-id').highcharts();
    

    where my-chart-id is set via the top-level id configuration option. Just make sure you
    register your script after the widget declaration so that it has a chance to initialize.

主要指标

概览
名称与所有者miloschuman/yii-highcharts
主编程语言JavaScript
编程语言PHP (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2011-12-24 19:35:21
推送于2016-11-16 16:31:58
最后一次提交2016-11-16 11:27:41
发布数21
最新版本名称v5.0.2 (发布于 )
第一版名称v0.4 (发布于 )
用户参与
星数32
关注者数8
派生数12
提交数65
已启用问题?
问题数11
打开的问题数2
拉请求数7
打开的拉请求数0
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?