如何在Yii中使用XGoogleChart

如何在Yii中使用XGoogleChart,yii,yii-extensions,Yii,Yii Extensions,我试着用XGoogleChart在Yii中创建饼图,我真的很想像本教程那样创建饼图,我试着编写如下简单代码: <?php $data=Stock::model()->findAll(array("select"=>"t1.item_name,stock", "join"=>"JOIN tb_dtl t1 ON

我试着用XGoogleChart在Yii中创建饼图,我真的很想像本教程那样创建饼图,我试着编写如下简单代码:

<?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.
));

?>


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

有控制台错误吗?你的扩展是否注册了css和javascripts?没有错误显示,实际上如果我尝试了下面的代码,图表运行良好:$this->widget('ext.widgets.google.XGoogleChart',array('type'=>'pie','title'=>'Market 2008','data'=>array('IE7'=>22,'IE6'=>30.7,'IE5'=>1.7,'Firefox'=>36.5,'Mozilla'=>1.1,'Safari'=>2,'Opera'=>1.4),'size'=>array(400300),'color'=>array('6f8a09','3285ce','dddddd'));当我试图更改数组代码'data'=>array('IE7'=>22,'IE6'=>30.7…)时出现问题,仅显示图表标签,谢谢