I am using highcharts 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
Array ( [0] => Array ( [name] => Food [y] => 91 ) [1] => Array ( [name] => Utilities [y] => 9 ) )
now this the structure of data which can be passed to highchart 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
although i made a similar manual array structure like this
$a = array('name'=> 'Opera','y'=>91);
$b = array('name'=> 'Safari','y'=>9);
$c = array($a,$b);
print_r($c) gives
Array ( [0] => Array ( [name] => Opera [y] => 91 ) [1] => Array ( [name] => Safari [y] => 9 ) )
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?????
Hey I found the bug it is basically the y value of $catexp is string and highchart needs number data to draw chart.
So i iterated through the $catexp and converted all y value to double now it is working fine.