This is my first extention
Requirements ¶
This should work from Yii 1.1
Usage ¶
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
- color1: color of the first bar;
- color2:color of the second bar;
- width:width of each bar;
- space:space between each bar,
- title:title of the graph, will be shown on the top of the graph;
- values: Most important, should be an multidimensional array like this;
- type:'simple'.
The parameters for multi bargraph are
- values: Multi dimensional array;
- colors: supports multiple colors so can be given as array.
- width: width of bar;
- title: title of the graph,will be shown on top of graph;
- legend: boolean either true or false;
- legends: can be given as array;
- type:'multi';
The parameters for stacked bargraph are
- values: Multi dimensional array;
- colors: supports multiple colors so can be given as array.
- width: width of bar;
- title: title of the graph,will be shown on top of graph;
- legend: boolean either true or false;
- legends: can be given as array;
- type:'stacked';
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..
Mahesh E.U ¶
Nintriva Wireless ¶
This widget uses the script from jqbargraph. credits:IVAN LAZAREVIC;
Nice 1
Nice extension mahesh.
very simple
easy to use...
thanks..
thanks
jQuery conflict
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 kapil
Thanks Kapil for that info, I will look into it.
conflict
there's a conflict between jqBarGraph and CJuiDatePicker
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.