Skip to content

Instantly share code, notes, and snippets.

@sangheestyle
Last active December 30, 2015 20:19
Show Gist options
  • Save sangheestyle/7879873 to your computer and use it in GitHub Desktop.
Save sangheestyle/7879873 to your computer and use it in GitHub Desktop.
Scene_4: Weekly trend based on weekday for tweet
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
[ 'weekday', 'Moto X: wk39', 'Moto X: wk40', 'Moto X: wk41', 'Moto X: wk43', 'Moto X: wk44', 'Moto X: wk45', 'Moto X: wk46', 'Moto X: wk47', 'Moto X: wk48', 'LG G2: wk39', 'LG G2: wk40', 'LG G2: wk41', 'LG G2: wk43', 'LG G2: wk44', 'LG G2: wk45', 'LG G2: wk46', 'LG G2: wk47', 'LG G2: wk48', 'Nexus 5: wk43', 'Nexus 5: wk46', 'Nexus 5: wk47', 'Nexus 5: wk48', ],
[ 'Mon', 0, 2344, 0, 0, 2103, 3251, 4916, 2679, 2459, 0, 5507, 0, 0, 2864, 1871, 2849, 1899, 2259, 0, 13013, 9999, 6265, ],
[ 'Tue', 0, 2277, 0, 0, 2809, 2497, 4425, 7247, 2461, 0, 3690, 0, 0, 5850, 3411, 2909, 1677, 1735, 0, 12319, 13878, 6771, ],
[ 'Wed', 0, 1646, 383, 926, 2663, 2710, 5820, 5237, 4445, 0, 4558, 718, 183, 3011, 2182, 2138, 2927, 1663, 0, 13491, 14127, 6031, ],
[ 'Thr', 0, 1961, 0, 1891, 3774, 2192, 1361, 3888, 3857, 0, 3667, 0, 2989, 2424, 3521, 352, 2097, 2169, 0, 1890, 9009, 5421, ],
[ 'Fri', 0, 2831, 0, 3991, 4825, 3356, 3573, 597, 3203, 0, 3042, 0, 2447, 2361, 2809, 1703, 553, 3048, 0, 7632, 1070, 5277, ],
[ 'Sat', 1238, 2672, 0, 2356, 2008, 1805, 2027, 510, 1902, 807, 2804, 0, 3594, 2081, 1759, 2029, 271, 3043, 1805, 7056, 1070, 4506, ],
[ 'Sun', 1693, 622, 0, 1428, 1447, 2563, 1693, 1887, 326, 4404, 565, 0, 2611, 1379, 1591, 1261, 1372, 503, 10378, 5465, 4324, 768, ],
]);
// Create and draw the visualization.
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {
title: 'Weekly Tweet Trends (tweet/weekday)',
width: 1200, height: 1000,
}
);
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization" style="width: 500px; height: 400px;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment