jqbargraph This extentions allows you to make bar graphs in few seconds

  1. Requirements
  2. Usage

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

  1. color1: color of the first bar;
  2. color2:color of the second bar;
  3. width:width of each bar;
  4. space:space between each bar,
  5. title:title of the graph, will be shown on the top of the graph;
  6. values: Most important, should be an multidimensional array like this;
  7. type:'simple'.

The parameters for multi bargraph are

  1. values: Multi dimensional array;
  2. colors: supports multiple colors so can be given as array.
  3. width: width of bar;
  4. title: title of the graph,will be shown on top of graph;
  5. legend: boolean either true or false;
  6. legends: can be given as array;
  7. type:'multi';

The parameters for stacked bargraph are

  1. values: Multi dimensional array;
  2. colors: supports multiple colors so can be given as array.
  3. width: width of bar;
  4. title: title of the graph,will be shown on top of graph;
  5. legend: boolean either true or false;
  6. legends: can be given as array;
  7. 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.

See Demo

Then you are done..

Thanks..

Mahesh E.U
Nintriva Wireless

This widget uses the script from jqbargraph. credits:IVAN LAZAREVIC;

12 0
16 followers
1 218 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: MAHESH.E.U
Created on: Jul 4, 2012
Last updated: 11 years ago

Downloads

show all

Related Extensions