make chart from custome queries using amcharts widget

This wiki article has not been tagged with a corresponding Yii version yet.
Help us improve the wiki by updating the version information.

Use this code in your view,make sure to put EAmChartWidget in your extension folder. here is the url of widget

$query ="SELECT count(*) as totalCalls,prov_destname as destination FROM `calls` WHERE status LIKE 'HUNGUP' AND startdate BETWEEN '$dateFrom' AND '$dateTo' AND customerID ='".Yii::app()->session['customerID']."' GROUP BY prov_destname ORDER BY totalCalls DESC LIMIT 5";
$connection     = Yii::app()->db;
$command        = $connection->createCommand($query);
$Results        = $command->queryAll();
$filedlabel ='This week';
$dataProvider=new CArrayDataProvider($Results,
array( 'keyField' =>'callID') );
      'width' => 500,
      'height' => 200,
                    'categoryField' =>'destination',
                    'angle' =>'30',
                    'depth3D' => '15'
      'chartType' => "AmSerialChart",
                             'valueField' => 'totalCalls',                                                      
   'type' => 'column',
                                                                        'balloonText'=>"[[destination]]: [[totalCalls]] call",
 'lineAlpha' => '0',
0 0
Viewed: 7 568 times
Version: Unknown (update)
Category: How-tos
Written by: Narender Negi
Last updated by: trond
Created on: Aug 5, 2013
Last updated: 8 years ago
Update Article


View all history