Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1249
  • Last Modified:

Google Charts (Stacked Bar Chart)

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
Isaac
Asked:
Isaac
  • 3
  • 2
1 Solution
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
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
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
0
 
Ioannis ParaskevopoulosCommented:
Hi,

See this fiddle that i modified from yours:

Giannis
0
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
Oh...that was clever and easy
0
 
Ioannis ParaskevopoulosCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now