Download the PHP package miloschuman/yii2-highcharts-widget without Composer
On this page you can find all versions of the php package miloschuman/yii2-highcharts-widget. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download miloschuman/yii2-highcharts-widget
More information about miloschuman/yii2-highcharts-widget
Files in miloschuman/yii2-highcharts-widget
Package yii2-highcharts-widget
Short Description Highcharts widget for Yii 2 Framework.
License MIT
Homepage https://github.com/miloschuman/yii2-highcharts
Informations about the package yii2-highcharts-widget
Yii2 Highcharts Widget
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
or add
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:
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:
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:
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
-
As of v10, This extension uses Asset Packagist to load the required Highcharts assets, so there is no need to change the version number in your
composer.json
file until the next major release.If you are upgrading from v9.0 or earlier, you will need to add the following to your
composer.json
file:Make sure the previously used fxp/composer-asset-plugin is disabled in your
composer.json
file:Then run
composer update
to install the new assets. -
If you need to use JavaScript in any of your configuration options, use Yii's [[JsExpression]] object. For instance:
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.
-
All adapters, modules, themes, and supplementary chart types must be enabled through the top-level 'scripts' option.
For a list of available scripts, see the contents of
vendor/npm/highcharts/
. -
You can access the JavaScript chart object from another script like this:
where
my-chart-id
is set via the top-levelid
configuration option. Just make sure you register your script after the widget declaration so that it has a chance to initialize. - 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.