Created
March 24, 2016 09:45
-
-
Save dominhhai/c1a550110b5ecc8b6774 to your computer and use it in GitHub Desktop.
Bar/ Column combo Stacked Bar/Column Chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.0','packages':['corechart']}]}"></script> | |
<script> | |
var visual | |
google.setOnLoadCallback(function () { | |
visual = google.visualization | |
drawChart() | |
}) | |
function drawChart() { | |
var data = visual.arrayToDataTable([ | |
['year', 'Austria', 'Bulgaria', 'Denmark'], | |
// 2003 | |
['2003', 1336060, null, null], | |
['', null, 400361, 1001582], | |
// group space | |
['', null, null, null], | |
// 2004 | |
['2004', 1336060, null, null], | |
['', null, 400361, 1001582] | |
]) | |
var options = { | |
title: 'Yearly Coffe Consumption by Country', | |
legend: {position: 'top'}, | |
bar: { groupWidth: '99%' }, | |
isStacked: true | |
} | |
var columnChart = new visual.ColumnChart(document.getElementById('chart_column')) | |
columnChart.draw(data, options) | |
var barChart = new visual.BarChart(document.getElementById('chart_bar')) | |
barChart.draw(data, options) | |
} | |
</script> | |
</head> | |
<body> | |
<div id="chart_column"></div> | |
<div id="chart_bar"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment