-
Notifications
You must be signed in to change notification settings - Fork 0
/
Google_chart_dashboard.html
168 lines (125 loc) · 5.69 KB
/
Google_chart_dashboard.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<head>
<title>My Dashboard's Title</title>
<!-- ***********************************************************************
***********************************************************************
************** Don't Change This **************************************
***********************************************************************
*********************************************************************** -->
<!--- Using Google Charts for visualization, bootstrap to set up page -->
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!--- which charts to load? -->
<script type="text/javascript">google.load('visualization', '1', {'packages':['annotatedtimeline', 'areaChart']});</script>
<!--- set timeout -->
<script type="text/JavaScript">function timedRefresh(ms) {setTimeout("location.reload(true);",ms);}</script>
<!-- ***********************************************************************
***********************************************************************
************** Chart 1 ************************************************
***********************************************************************
*********************************************************************** -->
<script type="text/javascript">
function chart1() {
// put the source's key and the data range here
var gKey = "0AsJDXPO0ATU2dGg2cDk1bXpoMFVhYXNFY2FDdEFvcXc";
var gRng = "A1:B99";
var wrapper = new google.visualization.ChartWrapper({
dataSourceUrl: 'http://spreadsheets.google.com/tq?key=' + gKey +
'&range=' + gRng + '&pub=1',
// change the chart type and options here
chartType: 'AreaChart',
containerId: 'chart1',
options: {'title': 'User Growth Q/Q',
'titleTextStyle': {'fontSize':32},
'legend': 'none'}
});
wrapper.draw();
};
google.setOnLoadCallback(chart1);
</script>
<!-- ***********************************************************************
***********************************************************************
************** Chart 2 ************************************************
***********************************************************************
*********************************************************************** -->
<script type="text/javascript">
function pullDataFromSpreadsheet() {
// put the source's key here
var gKey = "0AsJDXPO0ATU2dGg2cDk1bXpoMFVhYXNFY2FDdEFvcXc";
var query = new google.visualization.Query('http://spreadsheets.google.com/tq?key=' + gKey + '&pub=1'
);
//specify what you want returned and which function to call
query.setQuery('select A, C where C > 1');
query.send(chart2);
};
function chart2(response) {
var wrapper = new google.visualization.ChartWrapper({
dataTable: response.getDataTable(),
// change the chart type and options here
chartType: 'AreaChart',
containerId: 'chart2',
options: {
'title': 'Timeline Views / MAU',
'titleTextStyle': {'fontSize':32},
'legend': 'none',
'colors': ['red','#004411']
}
});
wrapper.draw();
};
google.setOnLoadCallback(pullDataFromSpreadsheet);
</script>
<!-- ***********************************************************************
***********************************************************************
************** Chart 3 ************************************************
***********************************************************************
*********************************************************************** -->
<script type="text/javascript">
function annotatedChart() {
// put the source's key here
var gKey = "0AsJDXPO0ATU2dGg2cDk1bXpoMFVhYXNFY2FDdEFvcXc";
var query = new google.visualization.Query('http://spreadsheets.google.com/tq?key=' + gKey + '&pub=1'
);
//specify what you want returned and which function to call
query.setQuery('select A, D, E, G where D > 0');
query.send(chart3);
};
function chart3(response) {
var wrapper = new google.visualization.ChartWrapper({
dataTable: response.getDataTable(),
// change the chart type and options here
containerId: 'chart3',
chartType: 'AnnotatedTimeLine',
options: {'displayAnnotations': true,
'fontSize': 32}
});
wrapper.draw();
};
google.setOnLoadCallback(annotatedChart);
</script>
</head>
<!-- now draw the page -->
<!-- timedRefresh counts milliseconds until the screen refreshes -->
<body onload="JavaScript:timedRefresh(30000);">
<h1>Current Status:</h1>
<!-- Put Top Row Charts Here -->
<div class="row-fluid">
<div class="span6">
<div id='chart1' style='height:600px;'></div>
</div>
<div class="span6">
<div id='chart2' style='height:600px;'></div>
</div>
</div>
<!-- Put Bottom Row Charts Here -->
<div class="row-fluid">
<div class="span1"></div>
<div class="span6">
<h3>Revenue and Cost Per 1000 Timeline Views</h3>
<div id='chart3' style='height:600px;'></div>
</div>
</div>
</body>
</html>