2017 © Pedro Peláez
 

yii2-extension yii2-highcharts

Highcharts widget for Yii 2 Framework.

image

consynki/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  • Friday, March 4, 2016
  • by levi-putna
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 50 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

Yii2 Highcharts Widget

Latest Stable Version Total Downloads License Scrutinizer Code Quality, (*1)

Easily add Highcharts, Highstock and Highmaps graphs to your Yii2 application., (*2)

Screen Shot, (*3)

About

Forked

This project is forckedform miloschuman/yii2-highcharts. With the goal of adding better remote loading of data., (*4)

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., (*5)

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., (*6)

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!, (*7)

Installation

The preferred way to install this extension is through composer., (*8)

Either run, (*9)

php composer.phar require --prefer-dist consynki/yii2-highcharts "dev-master"

or add, (*10)

"consynki/yii2-highcharts": "dev-master"

to the require section of your composer.json file., (*11)

Usage

Preferred Method (using PHP arrays)

To use this widget, insert the following code into a view file:, (*12)

use  consynki\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., (*13)

See /doc/examples for more usage examples., (*14)

Alternative Method (using JSON string)

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

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., (*16)

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:, (*17)

use consynki\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., (*18)

Tips

  • If you need to use JavaScript in any of your configuration options, use Yii's [[JsExpression]] object. For instance:, (*19)

    ...
    '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., (*20)

  • 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., (*21)

    ...
    'credits' => ['enabled' => false],
    ...
    
  • All adapters, modules, themes, and supplementary chart types must be enabled through the top-level 'scripts' option., (*22)

    ...
    '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/consynki/yii2-highchart/src/assets/., (*23)

  • You can access the JavaScript chart object from another script like this:, (*24)

    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., (*25)

  • The top-level 'callback' option allows you to initialize the chart after an AJAX request or other preprocessing. See included Highstock Widget Examples for usage.

The Versions

04/03 2016

dev-master

9999999-dev https://github.com/levi-putna/yii2-highcharts/

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Levi Putna
by Milo Schuman

extension yii2 widget highcharts highstock highmaps

04/03 2016

v4.3.0

4.3.0.0 https://github.com/levi-putna/yii2-highcharts/

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Levi Putna
by Milo Schuman

extension yii2 widget highcharts highstock highmaps

11/02 2016

v4.2.3

4.2.3.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

04/02 2016

v4.2.2

4.2.2.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

13/01 2016

v4.2.1

4.2.1.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

14/12 2015

v4.1.10

4.1.10.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

12/10 2015

v4.1.9

4.1.9.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

23/09 2015

v4.1.8

4.1.8.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

09/07 2015

v4.1.7

4.1.7.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

22/06 2015

v4.1.6

4.1.6.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

29/04 2015

v4.1.5

4.1.5.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

08/10 2014

v4.0.4.1

4.0.4.1 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

25/09 2014

v4.0.4

4.0.4.0 https://github.com/miloschuman/yii2-highcharts

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock highmaps

24/04 2014

v4.0.1

4.0.1.0 https://github.com/miloschuman/yii2-highcharts-widget

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock

17/03 2014

v3.0.10

3.0.10.0 https://github.com/miloschuman/yii2-highcharts-widget

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock

18/02 2014

v3.0.9

3.0.9.0 https://github.com/miloschuman/yii2-highcharts-widget

Highcharts widget for Yii 2 Framework.

  Sources   Download

MIT

The Requires

 

by Milo Schuman

extension yii2 widget highcharts highstock