This is my first extention
This should work from Yii 1.1
Installing and using this extension is very simple.
step1: copy the folder into your protected/extensions folder.
step2 include this into import section on config/main
'import'=>array( 'application.models.*', 'application.components.*', 'application.extensions.jqBarGraph.*', ),
step3 Then From your View you can call the widget like this
$this->widget('jqBarGraph',array(parameters));
The parameters for simple bargraph are
color1,color2,width,space,title,values;
The bars will be having alternate colors in simple bargraph
The parameters for multi bargraph are
The parameters for stacked bargraph are
So finally the code to call this widget will be like this,
/*this is how you can create a simple graph */ $array=array(array(200,'june'),array(129,'july'),array(143,'august'),array(159,'september')); $this->widget('jqBarGraph', array('values'=>$array, 'type'=>'simple', 'width'=>200, 'color1'=>'#122A47', 'color2'=>'#1B3E69', 'space'=>5, 'title'=>'simple graph')); /*this is how you can create a multi graph */ $array2=array(array(array(5,15,26),2008),array(array(14,6,26),2009),array(array(17,3,26),2010)); $colors=array('#3D0017','#6B0E1D','#AB2522'); $legends=array('legend1','legend2','legend3'); $this->widget('jqBarGraph', array('values'=>$array2, 'type'=>'multi', 'width'=>500, 'colors'=>$colors, 'legend'=>true, 'legends'=>$legends, 'title'=>'multi graph')); /*this is how you can create a stacked graph */ $array3=array(array(array(5,15,26),2008),array(array(14,6,26),2009),array(array(17,3,29),2010)); $colors2=array('#242424','#437346','#97D95C'); $legends2=array('legend1','legend2','legend3'); $this->widget('jqBarGraph', array('values'=>$array3, 'type'=>'stacked', 'width'=>500, 'colors'=>$colors2, 'legend'=>true, 'legends'=>$legends2, 'title'=>'stacked graph'));
You can replace the parameters with yours.
Then you are done..
Thanks..
This widget uses the script from jqbargraph. credits:IVAN LAZAREVIC;
Total 6 comments
there's a conflict between jqBarGraph and CJuiDatePicker
Thanks Kapil for that info, I will look into it.
Nice extension but , there is a jquery conflict when graph is displayed along with Yii grid. This is the conflict message 'jQuery(...).live is not a function' which prevents other extensions from displaying. In my case the extension that did'nt work was 'ext.UiGridView.'
thanks
easy to use...
Nice extension mahesh.
Leave a comment
Please login to leave your comment.