Skip to content

Instantly share code, notes, and snippets.

@revox
Last active November 1, 2018 09:54
Show Gist options
  • Save revox/dc4aba79d91cc7c10bfb to your computer and use it in GitHub Desktop.
Save revox/dc4aba79d91cc7c10bfb to your computer and use it in GitHub Desktop.
Starting point for class exercise in using Google Charts
<!DOCTYPE html>
<html>
<head>
<title>Bonds - who is the most violent?</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart', 'bar']});
google.setOnLoadCallback(drawBasic);
function drawBasic() {
var data = google.visualization.arrayToDataTable([
['Actor', 'Average kills per movie'],
['Pierce Brosnan', 33.75],
['Daniel Graig', 13.5],
['Roger Moore', 12.9],
['Timothy Dalton', 11.5]
]);
var options = {
title: 'Who is the most violent Bond?',
chartArea: {width: '70%'},
hAxis: {
minValue: 0
}
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment