如何在Yii中使用XGoogleChart

时间:2013-04-24 13:45:41

标签: yii yii-extensions

我试图在Yii中使用XGoogleChart创建饼图,我真的想创建像本教程http://www.eha.ee/labs/yiiplay/index.php/en/site/extension?view=charts这样的饼图,我尝试制作这样的简单代码:

<?php
$data=Stock::model()->findAll(array("select"=>"t1.item_name,stock",
                                              "join"=>"JOIN tb_dtl t1 ON   
                                                       t1.brg_id=t.brg_id",
                                              'limit'=>5

 ));

$items=array();
foreach($data as $i)
{
   $items1=$i['item_name'];
   $items2=$i['stock'];
   $items[]=array($items1 => $items2);
}

$this->widget('application.extensions.XGoogleChart',array(
    'type'=>'pie',
    'title'=>'Inventory',
    **'data'=>$items,**
    'size'=>array(400,300), // width and height of the chart image
    'color'=>array('6f8a09', '3285ce','dddddd'), // if there are fewer color than slices, then colors are interpolated.
));

?>

问题是图表没有显示,我的代码有什么问题,任何机构都可以帮助我。感谢

0 个答案:

没有答案