Dynamic Data With Yii Highcharts

Hi all,

I am facing a problem of displaying data from database into bar column using Yii Highcharts. I know the problem that I cant display the value of data from database is because of the string value instead of integer value. But, I don’t know how to convert the string value into integer value. Anyone can help me please? Thanks in advance.

view file


$xAxis =  Yii::app()->db->createCommand()





$data =  Yii::app()->db->createCommand()






echo print_r($value);			



        'options' =>array(                         

            'title' => array('text' => 'Total No. Of Students According To Course'),

            'xAxis' => array(

                'categories' => $xAxis,                  


            'yAxis' => array(

                'title' => array('text' => 'Total No. Of Students'),                       


            'series' => array(

                array('name'   => 'Course',

				'data'   => $data,  //error:cant show the value

				'shadow' => false,






When I print_r the value, it returns ‘[color="#FF0000"]array(5) { [0]=> string(3) “100” [1]=> string(2) “80” [2]=> string(2) “30” [3]=> string(2) “50” [4]=> string(2) “10” } 1[/color]’.

It is not correct and I wish to have the value in integer type like ‘[color="#FF0000"]array(5) { [0]=> int(3) “100” [1]=> int(2) “80” [2]=> int(2) “30” [3]=> int(2) “50” [4]=> int(2) “10” } 1[/color]’

Any idea how to convert from string value into integer value??

Is there anyone knows how to solve this problem? :blink:


you can add doubleval(), its convert string to int value.

or you can read this,in indonesian language CMIIW

use this $data=array_map(‘intVal’, $data);

Thanks alot, Ahamed Rifaideen! It works well to me. The data is shown after I add that line of code. Thank you so much for your help :lol:

Thanks for the help, mrkoeh! I bet this is another good way of displaying data using Yii Highcharts. :lol:

all the best beginner123 :)