Highcharts Plugin for CakePHP 2.*
Thank you for trying out Highcharts plugin for CakePHP 2.*!
Please note that this plugin is still a work-in-progress, with only the basic functionality to reproduce the charts available through the Highcharts library. More features will be added and the existing ones will be improved as you discover better ways of doing things and send me pull requests.
Please send your comments and suggestions to d3stinydriv3n[at]gmail.com
For those of you who simply want take a quick look at this plugin's features, demos are available at:
Deploy the plugin in your
app/Plugin/Highcharts directory. If you're using
Git, run this while in your app folder:
git init git submodule add git://github.com/destinydriven/cakephp-highcharts-plugin.git Plugin/Highcharts git submodule init git submodule update
In your Plugin directory type
git clone git://github.com/destinydriven/cakephp-highcharts-plugin.git Highcharts
Or download the plugin manually to your
Since CakePHP 2.0 it is necessary to activate the plugin in your application. To do so,
app/Config/bootstrap.php and add the line
CakePlugin::load('Highcharts'); at the
bottom. If you already have
CakePlugin::loadAll(); then you may skip this step.
You're done. Check the demo charts included in the plugin to see how to generate individual chart types. Open the demos in your browser:
[your app root]/highcharts/highcharts_demo
Be sure to first check out the Minimalist Demo for tips on how to quickly set up Highcharts Plugin in your own projects. The Minimalist Demos also demonstrate theme usage where you can add predefined customizations to your charts by simply specifying the key:
'chartTheme' => 'dark-blue' // other options are 'skies', 'grid', 'gray', 'dark-green'
in your $params array on your setChartParams() call.
The other examples provide tons of customization options which you may not want to bother with initially.
Implementing Highcharts to your app would simply include adding the Highcharts component to your controller. (See examples for more details)
public $components = array('Highcharts.Highcharts');
Through the inclusion of the component, the Highcharts helper is automatically made available to your views.
Special Dependency Note
This plugin depends on jQuery (http://jquery.com) so you would need to ensure that it is loaded in your layout or the view in which you want to display your charts. An example of how to load jQuery in your layout is available in:
Highcharts/View/Layouts/chart.demo.ctp <?php ... echo $this->Html->script(array('https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js')); ... echo $this->fetch('script'); ?>
Of course, you may also use a copy of the jQuery library from your app/webroot/js folder like this:
<?php ... echo $this->Html->script(array('jquery.min')); ... echo $this->fetch('script'); ?>
This plugin is NOT compatible with CakePHP 1.3.* versions.
This plugin has been tested with CakePHP 2.5.7 and so far works without issue.
If you would like to contribute, clone the source on GitHub, make your changes and send me a pull request. If you are unable to fix the issue, create a ticket and we'll see what happens from there.
Obviously, this plugin is using Highcharts Free, freely available for non-commercial use from http://www.highcharts.com/
This plugin also utilizes HighRoller (an object-oriented PHP wrapper for Highcharts) http://www.highroller.io/ HighRoller is also available on Github and is licensed under the Apache 2.0 license. https://github.com/jmaclabs/HighRoller
Special Thanks To:
- Lecterror (https://github.com/lecterror) for providing the inspiration to create this plugin
- Jigzstar https://github.com/jigzstar for introducing me to Highcharts.
- Tigrang https://github.com/tigrang for assistance in improving Highcharts helper
It might be instructive to take a look at the HighRoller README file (Plugin Vendor's Folder) to get a better idea of how it all works Additionally, if you are looking to extend this plugin, a good place to start would be the Highcharts API Reference http://api.highcharts.com/highcharts/