Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bar chart in Javascript: stacked bars + grouped bars

I'm looking for a Javascript solution to mix Grouped and Stacked Bars with a beautiful graph, such as those provided by Protovis.

For example if I want to compare downloads on Apple (iPads+iPhones) devices to Android devices, I might have (excuse my terrible ascii art)


60k |             ^
50k |    #    ^   ^
40k |#   #    ^  #^
30k |@   #^   ^  #^
20k |@^  #^  #^  @^
10k |@^  @^  @^  @^
   =================
    Jan Feb Mar Apr

Legend
#: iPad Downloads
@: iPhone Downloads
^: Android Downloads
like image 340
ewalk Avatar asked Feb 18 '11 15:02

ewalk


People also ask

What is the difference between a stacked and clustered bar chart?

Stacked column charts are great for displaying the contributions of parts of a whole (eg. how much each product line contributed to the total revenue). Clustered column charts excel at being the most comprehensible while comparing the absolute values visually.


2 Answers

Checkout Google Chart Tools and Google Visualization

for instance you can specify the following:

enter image description here

cht=bvs
chco=4D89F9,C6D9FD
chd=t:10,50,60,80,40|
  50,60,100,40,20
chds=0,160

let's say if you change the chd to

enter image description here

cht=bvs
chs=250x150
chco=4D89F9,C6D9FD
chd=t:0,50,0,80,0, 10, 50, 40
      60,0,100,0,20, 50, 100, 60
chds=0,160

Take a look at the chart above (as if its a group chart, but actually its stacked). Then you can append data after to create stacked 'looking' group as the graph is intended.

like image 130
KJYe.Name Avatar answered Oct 13 '22 20:10

KJYe.Name


Hey I just developed grouped+stacked bar chart on d3.js.

  • Source

  • Demo

like image 44
gencay Avatar answered Oct 13 '22 22:10

gencay