This extension encapsulates the Highcharts graphing widget.

Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.
Compared to the other JavaScript charting libraries (Flot, jqPlot), Highcharts requires a more verbose configuration but also produces higher quality (animated) graphs, supports more advanced options without plugins, and uses only a single JavaScript file.
Please use the 'Reviews' tab only for reviews. If you have questions, requests, or bug reports use the links below.
Note: Highcharts is not free for commercial use. For more information, please visit the Highcharts License and Pricing page.
protected/extensionsTo use this widget, you may insert the following code in a view:
$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 (e.g. double quotes) when using the second option. You can quickly validate your JSON string online using JSONLint.
js: prefix. For instance:... 'tooltip' => array( 'formatter' => 'js:function(){ return this.series.name; }' ), ...
... 'credits' => array('enabled' => false), ...
... 'exporting' => array('enabled' => false), ...
The Exporting module script file will not be registered if all highcharts widgets on a page have this option set to false.
.js".... 'theme' => 'dark-blue', ...
Four sample themes are provided in protected/extensions/highcharts/assets/themes/. Any custom theme files must be saved in this same directory.
Total 20 comments
the best chart ever. thanks
Can it works with CActiveDataProvider, just like CGridView?How can I pass a dataprovider to Highcharts's series?Thanks!
Try fix it out
if(isset($this->options['exporting']['enabled']))
from
// register exporting module if enabled via the 'exporting' option if($this->options['exporting']['enabled'])
// register global theme if specified vie the 'theme' option if($this->options['theme'])
If you use this:
where $data is supposed to by an array of integers, typecast them to integers to make it work.
Otherwise it will take the first integer and use it as the title and the second integer will be the value (the issue @rulight was having).
I am using high chart in my yii based application.
after querying the database I am storing the result in a associative array named $catexp after printing the structure using print_r($catexp) I am getting follwing
now this the structure of data which can be passed to highcart for generating pie chart.
but after passing this $catexp as data for pie chart I am getting wired output i.e. i am not getting the full chart and as the no. of entries increasing the chart becoming shorter and shorter.
although i made a similar manual array structure like this
print_r($c) gives
and passed this variable as data for pie chart and i got the full chart.
So my question is what is wrong with my previous chart both the array structures are same but output is diff?????
so great....
Thank you for highchart, thank you for milomilo. as a custom developer for office application, tools like this is very very very usefull...
Thanks again..
Update: New High-Chart Support Theme Option, easily.... greatttt.. thx milomilo...
nice extention :) thank you
another thing i'll have to pay a license for...
great extension btw! gonna keep an eye on this
another thing i'll have to pay a license for...
great extension btw! gonna keep an eye on this
Hi, I had this problem too, and I found the solution.. if you do the chart in this way:
'series' => array( array('name' => 'Average', 'data' => array($avlength, $avspeed,$totaltime)),
and $avlength=23; the result of the chart is the label 2 and the value 3 (maybe this is a bug, I don't knoW) instead you must create the chart in this way:
'series' => array( array('name' => 'Average', 'data' => array(array('av',$avlength),array('av',$avspeed),array('av',$totaltime))),
In this way the result would be label 'av' and the correct value (23),
I think that this is what is happening to you : Array ( [0] => 18 [1] => 18.5 [2] => 18.75 ) the label is always 1 and the value is 8.....
@sbasuki - You may have figured it out but for those who haven't; to pass data to a pie chart use a multidimensional array. For example:
Great extention! Thank you!
Great Extension, it helps me...
How to display pie chart using highcharts?
Great extension!
By the way I was trying to populate data for series.
'series' => array( array('name' => 'Line1', 'data'=> array($dataY)), array('name' => 'Line2', 'data' => array(16, 16, 17)) )
Where $dataY is an array like this: Array ( [0] => 18 [1] => 18.5 [2] => 18.75 )
But the chart only displays well Line2 and Line1 only gets (8,8,8) I am doing something wrong?
Thanks.
Thank you, canreo, for pointing out the missing file. I re-uploaded the highcharts-v0.3.zip package with all files included. Cheers!
Could you please double check your recent 0.3 package? You seem to be missing "HighchartsWidget.php" All I see are the .js file. Thanks!
aravaro, thanks for the error info. I have just released version 0.3 which is compatible with earlier versions of PHP. Happy coding!
Hi, unfortunately i am not able to apply this with ajax call. can this work upon ajax call? thanks.
necesita: PHP 5 >= 5.3.0 con una versión menor da error
Fatal error: Call to undefined function array_replace_recursive() in protected/extensions/highcharts/HighchartsWidget.php on line 94
amazing!
thanks very much!
Hi, milomilo. Great job. I just downloaded it and its working fine ! Thanks
Leave a comment
Please login to leave your comment.