$tadates=Target::model()->findAll( array( 'select'=>'date, achived', 'condition'=>'user_id="'.$model->user_id.'"' )); $xAxis=array(); $yAxis=array(); foreach($tadates as $tadate): $xAxis[]=date("M, Y",strtotime($tadate->date)); $targetvalue[] = 100*1; $yAxis[]=$tadate->achived*1; endforeach; $this->Widget('ext.highcharts.HighchartsWidget', array( 'options'=> array( 'credits' => array('enabled' => false), 'exporting' => array( 'enabled' => true, ), 'title' => array( 'text' => 'Target', ), 'xAxis' => array( 'title' => array( 'text' => 'Year', ), 'categories' => $xAxis, ), 'yAxis' => array( 'title' => array( 'text' => 'Target', ), ), 'series' => array( array( 'name' => 'Target chart', 'data' => $yAxis, 'shadow' => false, 'type' => 'column', ), array( 'name' => 'Target Value', 'data' => $targetvalue, 'color'=> '#8bbc21', 'shadow' => false, 'type' => 'column', ) ) ) ) );
Thursday, March 6, 2014
yii highcharts
Subscribe to:
Posts (Atom)