Skip to content

Instantly share code, notes, and snippets.

@pkhamre
Created March 12, 2014 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkhamre/9503533 to your computer and use it in GitHub Desktop.
Save pkhamre/9503533 to your computer and use it in GitHub Desktop.
Simple google graph
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Day', 'Number of 502s'],
['2013-01-20', 372],
['2013-01-21', 451],
['2013-01-22', 134],
['2013-01-23', 70],
['2013-01-24', 27],
['2013-01-25', 48],
['2013-01-26', 0],
['2013-01-27', 8],
['2013-01-28', 75],
['2013-01-29', 433],
['2013-01-30', 561],
['2013-01-31', 351],
['2013-02-01', 1338],
['2013-02-02', 4],
['2013-02-03', 1746],
['2013-02-04', 1743],
['2013-02-05', 567],
['2013-02-06', 455],
['2013-02-07', 687]
]);
var options = {
title: 'Total number of 502s in the access logs',
hAxis: {title: 'Day', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.AreaChart(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