-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprograms.html
358 lines (281 loc) · 14 KB
/
programs.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE html>
<html>
<head>
<title>
Measure G - By Program
</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- used for social icons -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!--Load the AJAX API. Do this only once per web page! -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.1', {'packages':['bar']});
//Get Data from CartoDb
sql = "SELECT split_part(prog_desc,' - ',2) as program, " +
"split_part(obj_desc,' - ',2) as category, " +
"SUM(ytd_actual) total " +
"FROM measure_g_2013_14 " +
"GROUP BY obj_desc, prog_desc " +
"HAVING SUM(ytd_actual) > 1000 " +
"ORDER BY program, total ";
// Group objects by program
var dataByProgram = {};
// Call cartodb
// $.getJSON('https://jbaldo.cartodb.com/api/v2/sql/?q='+sql, function(data) {
// $.each(data.rows, function(key, row) {
// var program = row.program;
// delete row.program;
// item = [row.category, row.total]
// if(dataByProgram[program]) {
// dataByProgram[program].push(item);
// } else {
// dataByProgram[program] = [item];
// }
// });
// //Add a header to each program data set (only happens once)
// for(var key in dataByProgram) dataByProgram[key].unshift(['Expense Type', 'Amount Spent']);
// });
$.getJSON('programs.json', function(data) {
$.each(data, function(key, row) {
var program = row.program;
delete row.program;
item = [row.object, row.g2014, row.g2013, row.g2012]
if(dataByProgram[program]) {
dataByProgram[program].push(item);
} else {
dataByProgram[program] = [item];
}
});
//Add a header to each program data set (only happens once)
for(var key in dataByProgram) dataByProgram[key].unshift(['Expense Type', '2012-13', '2013-14', '2014-15']);
});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
var supportedPrograms = {
'art': 'ART',
'basic-school-support': 'BASIC SCHOOL SUPPORT',
'class-size-reduction': "CLASS SIZE REDUCTION",
'elementary-intervention': "COVERED ELEM INTERVENTION PDS",
'hr-recruitment': "HR Recruitment",
'middle-school-electives': "MIDDLE SCHOOL ELECTIVES",
'music': "MUSIC",
'nclb-hqt-compliance': "NCLB HQT COMPLIANCE",
'arts-summer-school': "Oakland Fine Arts Summer Schl",
'oratorical-fest': "ORATORICAL FEST/PERFORMANCES",
'oth-programs': "OTH PROGRAMS / LOCAL GOALS",
'libraries':"SCHOOL LIBRARIES"
}
//get selected program from URL
var selectedProgram = window.location.hash.slice(1);
if(selectedProgram in supportedPrograms) {
var programDataKey = supportedPrograms[selectedProgram];
} else {
selectedProgram = "art";
window.location.hash = "art";
}
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
function updateChartData(programId) {
window.location.hash = programId;
var programDataKey = supportedPrograms[programId];
var dataWithHeaders = dataByProgram[programDataKey];
var numBars = dataWithHeaders.length - 1;
var chartHeight = numBars * 70;
var data = google.visualization.arrayToDataTable(dataWithHeaders);
data.sort([{column: 1, desc:true}]);
var chart = new google.charts.Bar(document.getElementById('chart_div'));
google.visualization.events.addListener(chart, 'ready', function() {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
var options = {
chart: {
},
bars: 'horizontal', // Required for Material Bar Charts.
height: chartHeight,
axes: {
x: {
0: { side: 'top', label: 'Amount spent'} // Top x-axis.
}
}
};
chart.draw(data, google.charts.Bar.convertOptions(options));
$('#program-select div').removeClass('active');
$('#program-select #'+programId).addClass('active');
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
updateChartData(selectedProgram);
$('#program-select #'+selectedProgram).addClass('active');
$('#program-select').click(function(event) {
updateChartData(event.target.id);
});
}
</script>
<style type="text/css">
html, body {
height: 100%;
padding: 0;
margin: 0;
background-color:#fff;
text-rendering:optimizeLegibility;
-webkit-text-rendering:optimizeLegibility;
-webkit-font-smoothing:antialiased;
color:#333;
font-weight:300;
line-height:25px;
font-family:"Proxima Nova W01","Helvetica Neue",Helvetica,Arial,sans-serif
}
/* Wrapper for page content to push down footer */
#wrap {
min-height: 100%;
height: 100%;
}
#wrap > .center-container {
padding: 50px 0 0 0;
margin:0;
}
.center-container, .center-row {
height:100%;
}
.preview-image {
width: 100%;
}
/* Nav Social Links */
ul.social a.twitter:hover {
color: #00aced;
}
ul.social a.facebook:hover {
color: #3b5998;
}
/*Program Selector*/
#program-select, h3 {
display: table;
margin: 0 auto;
margin-top: 20px;
margin-bottom: 20px;
}
.program {
font-weight: bold;
display: inline-block;
padding: 5px 8px;
margin: 1px 1px;
cursor: pointer;
}
.program.active, .program.active:hover {
color: white;
background-color: #4285F4;
border-radius: 5px;
}
.program:hover {
color: black;
background-color: #E7E7E7;
border-radius: 5px;
}
</style>
<!--Google analytics snippet -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-35908939-11', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<!-- Wrap all page content here -->
<div id="wrap">
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-target" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index"><strong>Track G - Oakland's Measure G</strong></a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-target">
<ul class="nav navbar-nav">
<li class=""><a href="index">About</a></li>
<li class=""><a href="map">By Location</a></li>
<li class="active"><a href="programs#art">By Program</a></li>
<li class=""><a href="chart">By School</a></li>
<li class=""><a href="treemap">In Summary</a></li>
</ul>
<ul class="nav navbar-nav navbar-right social">
<li>
<a class="twitter" href="https://twitter.com/intent/tweet?hashtags=OAKEDU&original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&ref_src=twsrc%5Etfw&text=Explore%20how%20Measure%20G%20funds%20are%20spent%20in%20%23Oakland%20Schools!&tw_p=tweetbutton&url=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&via=OpenOakland" target="_blank">
<i class="fa fa-twitter fa-lg"></i>
</a>
</li>
<li>
<a class="facebook" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Ftrackg.org" target="_blank" class="fbhover"><i class="fa fa-facebook fa-lg"></i></a>
</li>
</ul>
</div>
</div>
</div>
<!-- Begin page content -->
<div class="center-container">
<div class="center-row">
<div class="container">
<div id="program-select">
<div class="program" id="art">Art</div>
<div class="program" id="basic-school-support">Basic School Support</div>
<div class="program" id="class-size-reduction">Class Size Reduction</div>
<div class="program" id="elementary-intervention">Elementary Intervention</div>
<div class="program" id="hr-recruitment">HR + Recruitment</div>
<div class="program" id="libraries">Libraries</div>
<div class="program" id="middle-school-electives">Middle School Electives</div>
<div class="program" id="nclb-hqt-compliance">NCLB Compliance</div>
<div class="program" id="music">Music</div>
</div>
<h3>How is money spent on this program across the district?</h3>
<div id="chart_div"></div>
</div>
</div>
</div>
</div> <!-- end wrap -->
<!-- Place your code in the script tags below -->
<script type="text/javascript">
window.onload = function() {
}
</script>
<script>
// Include the UserVoice JavaScript SDK (only needed once on a page)
UserVoice=window.UserVoice||[];(function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/fE7XpxXMOWc2yipGiIhow.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})();
//
// UserVoice Javascript SDK developer documentation:
// https://www.uservoice.com/o/javascript-sdk
//
// Set colors
UserVoice.push(['set', {
accent_color: '#6aba2e',
trigger_color: 'white',
trigger_background_color: '#6aba2e',
forum_id: '347124',
strings: {
post_suggestion_title: 'Post an idea to improve this page',
post_suggestion_body: 'Publica una idea para mejorar esta página. \n 张贴想法,以改善此页面',
suggestion_category_label: 'Which page are you on?'
}
}]);
// Add default trigger to the bottom-right corner of the window:
UserVoice.push(['addTrigger', {mode: 'feedback', trigger_position: 'bottom-right' }]);
// Autoprompt for Satisfaction and SmartVote (only displayed under certain conditions)
UserVoice.push(['autoprompt', {}]);
</script>
</body>
</html>