Solved

Google Charts (Stacked Bar Chart)

Posted on 2013-05-13
5
1,176 Views
Last Modified: 2013-05-14
Hi all,

I have been using google charts to create all type of charts but I have not been able to create a stacked combo bar.  I'm trying to create a chart that looks like...
stacked bar
Here's what I've done so far....
stacked bar 2
Here's the code for it...
function drawVisualization() {
  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable([
    ['Fiscal Year', 'Planned', 'Actual', 'Anticipated'],
    ['FY12',  42,      938, 60],
    ['FY13',  135,      1120, 955]   
  ]);

  // Create and draw the visualization.
  var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
  ac.draw(data, {
    title : 'SITES',
    width: 600,
    height: 400,
    vAxis: {title: "Number of Sites"},
    hAxis: {title: ""},
    seriesType: "bars",
    series: {5: {type: "line"},
    isStacked:true}
  });
}
¿

Open in new window


Paste it in below and click row
https://code.google.com/apis/ajax/playground/?type=visualization#combo_chart
0
Comment
Question by:Isaac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Author Comment

by:Isaac
ID: 39163299
Ok.  I found a hack
http://jsfiddle.net/a5x3e/

All I need to do now is add "FY12" and "FY13" at the bottom of the chart appropriately.

Any ideas?
0
 
LVL 5

Author Comment

by:Isaac
ID: 39163301
0
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 500 total points
ID: 39164282
Hi,

See this fiddle that i modified from yours:

Giannis
0
 
LVL 5

Author Comment

by:Isaac
ID: 39164389
Oh...that was clever and easy
0
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39164461
Hi, i am glad it works for you... I tried combining them but couldn't have one not stacked and the other two stacked in the same group (sorry)

Giannis
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question