Yii 1.1: using jqbargraph to create beautiful graphs


If you are about to create a graph, the best option i would suggest is the jqbargraph.

The advantages of jqbargraph is

  1. its very easy to install
  2. it is very simple to use.
  3. it contains 3 types of graph (simple multi and stacked)
  4. easy customization like colors spaces etc..

So to begin with..

First you need to download the extension and put this is your extensions folder

Now like most of the other widgets you need to configure it in config/main file


Now you can use the jqbargraph by calling the widget


Now the parameters may vary based on the type of graph you need lets start with the simple graph.

this one is the most commonly used graph


if you are using simple graph

you should give the first parameter

  • type => simple

The other parameters are

  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.


so the final code will be

'title'=>'simple graph'));

Now second type of graph is the multigraph


In order to use multigraph the type you should give is

  • type=>multi

the other attributes are much similar except we need to give arrays for the colors and legends .

the final code will be like this

'title'=>'multi graph'));

The third type of graph is stacked graph.


This has the same parameters as the multigraph except the type

the type should be

  • type => stacked

so the final code will be like this

'title'=>'stacked graph'));

you can see the live demo here


Mahesh E.U

Total 1 comment

#14881 report it
P.Vimal Raj Kumar at 2013/09/18 06:24am
Type 'multi' and 'stacked' graphs are not working.

Hi Mahesh E.U,

I tried this jqBarGraph. Only the type "simple" is working. and other two types are not

working. Could you please help me out..

Thanks in advance..

Leave a comment

Please to leave your comment.

Write new article