Hi, I’m implementing line chart to my application using “flot” extension. I dont know how to pass dynamic values by using this extension. So, i tried like this in model
public function getGraphData()
{
$criteria=new CDbCriteria;
//$criteria->addCondition('CreatedDate > datetime(\'now\', \'-1 day\', \'localtime\')');
$sort = new CSort();
$sort->defaultOrder='updatedDate';
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>$sort,
'pagination'=>false,
));
}
[size=2]
[/size]
[size=2]And my view page code is like this…[/size]
[size=2]
[/size]
<?php
// lines and bars in same graph
$model = new UsersStatsInfo();
foreach ($model->getGraphData()->getData() as $row) {
$data[]=array($row['id'],$row['height']);
}
$this->widget('application.extensions.EFlot.EFlotGraphWidget',
array(
'data'=>array(
array(
'label'=> 'line',
'data'=> $data,
/*array(
array(1,50),
array(2,25),
array(3,45),
array(4,15),
array(5,75),
array(6,55),
),*/
'lines' => array('show'=>true),
'points'=> array('show'=>true),
'xaxis' => array(
'mode' => 'time',
'timeformat'=>'%y/%m/%d'
),
),
),
'options'=>array(
'legend'=>array(
'position'=>'nw',
'show'=>true,
'margin'=>10,
'backgroundOpacity'=> 0.5,
),
),
'htmlOptions'=>array(
'style'=>'width:600px;height:400px;'
)
)
);
?>
[size=2]
[/size]
[size=2]Like this i’m retrieving only one field in $data[], can i know how to retrieve all fileds in $data[]. My database fields are like “weight, height, chest, hips, biceps…”.[/size]
[size=2]
[/size]
This way i’m plotting only height values, Pls help me how to solve this problem.