-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
493 lines (431 loc) · 21.9 KB
/
index.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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' name='viewport'>
<meta property="og:title" content="RRP6 FINANCIAL TRACKING -JORDAN - 2016"/>
<meta property="og:type" content="article"/>
<meta property="og:site_name" content="RRP6 FINANCIAL TRACKING -JORDAN - 2016"/>
<meta property="og:description" content="RRP6 FINANCIAL TRACKING -JORDAN - 2016"/>
<title>Jordan Inter-Agency Financial Tracking - 2016 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link rel="stylesheet" href="css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="css/bootswatch.min.css">
<link rel="stylesheet" href="css/font-humanitarian.css">
<link rel="stylesheet" type="text/css" href="css/dc.css"/>
<link rel="stylesheet" type="text/css" href="css/dashboard.css"/>
<!---->
<!-- Add IntroJs styles and JS -->
<link rel="stylesheet" type="text/css" href="css/introjs.min.css" >
<script type="text/javascript" src="js/intro.min.js"></script>
<script src="js/jquery.js"></script>
<!-- map the data to the GeoJSON object -->
<script src="js/data-jo.js"></script>
<link href="http://www.unhcr.org/favicon.ico" rel="icon" type="image/x-icon">
<!-- hide and display Disclaimer -->
<script>
function show(shown, hidden) {
document.getElementById(shown).style.display='block';
document.getElementById(hidden).style.display='none';
return false;
}
</script>
</head>
<body>
<div class ="col-sm-4 col-md-offset4" id="loading">
<small>This webpage does not work on IE8 or older... Upgrade your browser if needed</a></a></small>
</div>
<div class="container" id="dashboard">
<div class="socialmedia" data-step="13" data-intro="Share!!" data-position="left">
<table>
<tbody><tr>
<!--<td valign="middle"><a href="fts2014.html" target="_blank">Financial Tracking 2016</a></td> -->
</tr>
</tbody></table>
</div>
<div class="row" >
<h1>
<a href="http://data.unhcr.org/jordan"><img src="images/coordination.png" style="height: 48px; width: 48px"></a>
<strong>Jordan Inter-Agency Financial Tracking - 2016</strong>
</h1>
This Financial Tracking System (FTS) is based on funds received by refugee response partners in Jordan. It only covers the inter-agency appeal for the <b>refugee pillar</b> of the 3RP, in support of the Jordan Response Plan (JRP). The JRP FTS remains the authoritative source for funds pledged and allocated to the Jordan Resilience Plan (JRP) log-frame.
For more information, see <a href="http://www.jrpsc.org/financial-tracking/" target="_blank"> http://www.jrpsc.org/financial-tracking/ </a>.
<h2>
<a class="btn btn-default">Total Requested (USD) <a class="btn btn-primary">$ <span id="totalrequired" class="number-display"></span></a></a>
<a class="btn btn-default">Percentage Received <a class="btn btn btn-success"><span id="totalPreceived" class="number-display"> </span> %</a></a>
<a class="btn btn-default">Funds Received (USD) <a class="btn btn-info">$ <span id="totalreceived" class="number-display"></span></a></a>
<a class="btn btn-default">Not yet funded (USD) <a class="btn btn-warning">$ <span id="totalgap" class="number-display"></span></a></a>
<!--
<a class="btn btn-default">Gap <a class="btn btn-danger">% <span id="totalpercentage" class="number-display"></span></a></a>
-->
</h2>
<br>
<div id="count-info" >
You have selected <strong><span class="filter-count "></span> reports</strong> out of a total of <span class="total-count "></span> reports
<a class="btn btn-primary btn-sm" href="javascript:dc.filterAll();quarter_chart.filter('0- Overall');dc.redrawAll();">Click to reset all filters</a>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-xs-6" data-step="1" data-intro="Click on this pie chart to filter by sector." data-position='right'>
<div id="quarter"> <center> <h4>Quarters</h4> </center></div>
</div>
<div id="sector" class="col-xs-6" data-step="1" data-intro="Click on this pie chart to filter by sector." data-position='right'>
<center> <h4>Received funds across Sectors</h4> </center>
</div>
</div>
<div class="row">
<div id="gapReceived" class="col-xs-12" data-step="1" data-intro="Click on this pie chart to filter by sector." data-position='right'>
<center> <h4>Distribution of received funds/gap across Sectors</h4> </center>
</div>
</div>
<div class="row">
<center>
<table width=100% cellspacing=1 cellpadding=1>
<tr>
<td width=110px> </td>
<td></td>
<td><img src="images/cash.svg" alt="Cash" height="30px" width="30px"></td>
<td><img src="images/education.svg" alt="Education" height="30px" width="30px"></td>
<td><img src="images/foodsecurity.svg" alt="Food Security" height="30px" width="30px"></td>
<td><img src="images/health.svg" alt="Health" height="30px" width="30px"></td>
<td><img src="images/nfi.svg" alt="Health" height="30px" width="30px"></td>
<td><img src="images/protection.svg" alt="Protection" height="30px" width="30px"></td>
<td><img src="images/shelter.svg" alt="Shelter" height="30px" width="30px"></td>
<td><img src="images/wash.svg" alt="WASH" height="30px" width="30px"></td>
<td></td>
</tr>
</table>
</center>
<br>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div id="partner" class="col-xs-6" data-step="1" data-intro="Click on this pie chart to filter by sector." data-position='right'>
<center> <h4>Received funds per Agency</h4> </center>
</div>
<div id="partnergap" class="col-xs-6" data-step="1" data-intro="Click on this pie chart to filter by sector." data-position='right'>
<center> <h4>Funding gap per Agency</h4> </center>
</div>
</div>
</div>
</div>
</div>
<div width="100%" style="background:#006CA9; height:25px" align=right>
<span class="demoTableRow"><font color="#FFFFFF">
Produced by Information Management Unit, UNHCR, Jordan. For more information please contact <a href="http://data.unhcr.org/jordan/team.html" target="_blank" >our team</a> </font>
</span>
</div>
<script type="text/javascript" src="js/d3_002.js"></script>
<script type="text/javascript" src="js/crossfilter.js"></script>
<script type="text/javascript" src="js/dc.js"></script>
<script type="text/javascript" src="js/d3.tip.min.js"></script>
<script type="text/javascript" src="js/d3num.js"></script>
<script>
$('#dashboard').hide();
// var gap_chart = dc.pieChart("#gap");
var sector_chart = dc.rowChart("#sector");
var quarter_chart = dc.rowChart("#quarter");
var partner_chart = dc.rowChart("#partner");
var partnergap_chart = dc.rowChart("#partnergap");
var gapReceived_chart = dc.barChart("#gapReceived");
var tot = 8757315;
d3.csv("data/ftsnew.csv", function(csv_data){
var numberFormat = d3.format(".3s");
var cf = crossfilter(csv_data);
var all = cf.groupAll();
// Implement bookmarking chart filters status --> Thanks to https://github.com/franckalbinet
// Serializing filters values in URL
function getFiltersValues() {
var filters = [
// { name: 'gap', value: gap_chart.filters()},
{ name: 'sector', value: sector_chart.filters()},
{ name: 'quarter', value: quarter_chart.filters()},
{ name: 'partner', value: partner_chart.filters()},
{ name: 'partnergap', value: partnergap_chart.filters()}
];
var recursiveEncoded = $.param( filters );
location.hash = recursiveEncoded;
}
// Init chart filters
function initFilters() {
// Get hash values
var parseHash = /^#sector=([A-Za-z0-9,_\-\/\s]*)&status=([A-Za-z0-9,_\-\/\s]*)&org=([A-Za-z0-9,_\-\/\s]*)&map=([A-Za-z0-9,_\-\/\s]*)$/;
var parsed = parseHash.exec(decodeURIComponent(location.hash));
function filter(chart, rank) { // for instance chart = sector_chart and rank in URL hash = 1
// sector chart
if (parsed[rank] == "") {
chart.filter(null);
}
else {
var filterValues = parsed[rank].split(",");
for (var i = 0; i < filterValues.length; i++ ) {
chart.filter(filterValues[i]);
}
}
}
if (parsed) {
filter(sector_chart, 1);
filter(quarter_chart, 2);
filter(partner_chart, 3);
filter(partnergap_chart, 4);
// filter(gap_chart, 5);
}
}
// tooltips for row chart
var rowTip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.html(function (d) { return "<span style='color: #f0027f'>" + d.key + "</span> : " + numberFormat(d.value) + " USD"; });
// tooltips for pie chart
var pieTip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.html(function (d) { return "<span style='color: #f0027f'>" + d.data.key + "</span> : " + numberFormat(d.value) + " USD"; });
// tooltips for bar chart
var barTip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.html(function (d) { return "<span style='color: #f0027f'>" + d.data.key + "</span> : " + numberFormat(d.y) + " USD";});
cf.quarter = cf.dimension(function(d) { return d.Quarter; });
var quarterByTotal = cf.quarter.group().reduceSum(function (d) { return d.Receive; });
var quarter = cf.quarter.group();
quarter_chart.width(250).height(200)
.dimension(cf.quarter)
.group(quarterByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
//.data(function(group) { return group.top(5); })
.colors(['#5bc0de'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
/* .ordering(function(d) {
if(d.key == "0- Yearly") return 0;
else if(d.key == "1- First Quarter") return 1;
else if(d.key == "2- Second Quarter") return 2;
else if(d.key == "3- Third Quarter") return 3;
else if(d.key == "4- Fourth Quarter") return 4;
})*/
.xAxis().ticks(4).tickFormat(d3.format("s"));
quarter_chart.renderlet(function(chart) {
chart.selectAll('rect').on("click", function(d) {
if (d.key == "1- First Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("1- First Quarter");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "0- Overall")
{
quarter_chart.filterAll();
quarter_chart.filter("0- Overall");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "2- Second Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("2- Second Quarter");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "3- Third Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("3- Third Quarter");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "4- Fourth Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("4- Fourth Quarter");
dc.redrawAll();
dc.renderAll();
}
d3.selectAll("g.row").call(rowTip);
d3.selectAll("g.row").on('mouseover', rowTip.show).on('mouseout', rowTip.hide);
var stackChart = 'div#gapReceived.dc-chart rect';
d3.selectAll(stackChart).call(barTip);
d3.selectAll(stackChart).on('mouseover', barTip.show).on('mouseout', barTip.hide);
});
chart.selectAll('text').on("click", function(d) {
if (d.key == "0- Overall")
{
quarter_chart.filterAll();
quarter_chart.filter("0- Overall");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "1- First Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("1- First Quarter");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "2- Second Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("2- Second Quarter");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "3- Third Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("3- Third Quarter");
dc.redrawAll();
dc.renderAll();
}
else if (d.key == "4- Fourth Quarter")
{
quarter_chart.filterAll();
quarter_chart.filter("4- Fourth Quarter");
dc.redrawAll();
dc.renderAll();
}
d3.selectAll("g.row").call(rowTip);
d3.selectAll("g.row").on('mouseover', rowTip.show).on('mouseout', rowTip.hide);
var stackChart = 'div#gapReceived.dc-chart rect';
d3.selectAll(stackChart).call(barTip);
d3.selectAll(stackChart).on('mouseover', barTip.show).on('mouseout', barTip.hide);
});
});
cf.sector = cf.dimension(function(d) { return d.Sector; });
var sectorByTotal = cf.sector.group().reduceSum(function (d) { return d.Receive; });
var sector = cf.sector.group();
sector_chart.width(250).height(210)
.dimension(cf.sector)
.group(sectorByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(10); })
.colors(['#5bc0de'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.partner = cf.dimension(function(d) { return d.Partner; });
var partnerByTotal = cf.partner.group().reduceSum(function (d) { return d.Receive; });
var partner = cf.partner.group();
partner_chart.width(250).height(500)
.dimension(cf.partner)
.group(partnerByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(20); })
.colors(['#5bc0de'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.partnergap = cf.dimension(function(d) { return d.Partner; });
var partnergapByTotal = cf.partnergap.group().reduceSum(function (d) { return (d.Required - d.NewReceived); });
var partnergap = cf.partnergap.group();
partnergap_chart.width(250).height(500)
.dimension(cf.partnergap)
.group(partnergapByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(20); })
.colors(['#e99002'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.sectorGroup = cf.dimension(function(d) { return d.Sector; });
cf.gapReceived = cf.dimension(function(d) { return d.Receive; });
var gapByTotal = cf.sectorGroup.group().reduceSum(function (d) { return (d.Required - d.NewReceived); });
var receiveByTotal = cf.sectorGroup.group().reduceSum(function (d) { return d.NewReceived; });
var sectors = ["CASH","EDUCATION","FOOD SECURITY","HEALTH","NFI","PROTECTION","SHELTER","WASH"];
var gapReceived = cf.gapReceived.group();
var sectorGroup = cf.sectorGroup.group();
/* when any bar is clicked, recolor the chart */
var colorRenderlet = function (_chart) {
_chart.selectAll("rect.bar")
.on("click", function (d) {
function setAttr(selection, keyName) {
selection.style("fill", function (d) {
if (d[keyName] == "Received") return "#5bc0de";
else if (d[keyName] == "Gap") return "#e99002";
});
};
setAttr(_chart.selectAll("g.stack").selectAll("rect.bar"), "layer")
setAttr(_chart.selectAll("g.dc-legend-item").selectAll("rect"), "name")
});
};
gapReceived_chart.width(580).height(240)
.margins({top: 50, right: 20, left: 75, bottom: 20})
.dimension(sectorGroup)
.group(receiveByTotal,"Received")
.stack(gapByTotal,"Gap")
.x(d3.scale.ordinal().domain(sectorGroup))
.xUnits(dc.units.ordinal)
.renderHorizontalGridLines(true)
.barPadding(0.2)
.outerPadding(0.05)
.elasticY(true)
.brushOn(false)
.renderlet(colorRenderlet)
.legend(dc.legend().x(375).y(10).itemHeight(15).gap(1));
dc.dataCount("#count-info")
.dimension(cf)
.group(all);
var byRequired = cf.dimension(function(d) { return d.Required; });
var byRequiredGroup = byRequired.groupAll().reduceSum(function (d) { return d.Required; });
dc.numberDisplay("#totalrequired")
.valueAccessor(function(d){ tot = +d ; return +d})
.group(byRequiredGroup);
var byReceived = cf.dimension(function(d) { return d.Receive; });
var byReceivedGroup = byReceived.groupAll().reduceSum(function (d) { return d.Receive; });
dc.numberDisplay("#totalreceived")
.valueAccessor(function(d){return +d})
.group(byReceivedGroup);
dc.numberDisplay("#totalPreceived")
.valueAccessor(function(d){return +d / (tot/100) })
.group(byReceivedGroup);
var byGap = cf.dimension(function(d) { return d.Gap; });
var byGapGroup = byGap.groupAll().reduceSum(function (d) { return d.Required - d.NewReceived; });
dc.numberDisplay("#totalgap")
.valueAccessor(function(d){return +d})
.group(byGapGroup);
// var byPercentage = cf.dimension(function(d) { return d.Percentage; });
// var byPercentageGroup = byPercentage.groupAll().reduceSum(function (d) { return d.Percentage; });
var byPercentage = cf.dimension(function (d) { return (d.Gap / d.Required);});
var byPercentageGroup = byPercentage.groupAll().reduceSum(function (d) { return (d.Gap / d.Required);});
dc.numberDisplay("#totalpercentage")
.valueAccessor(function(d){return +d})
.group(byPercentageGroup);
$('#loading').hide();
$('#dashboard').show();
dc.renderAll();
quarter_chart.filterAll();
quarter_chart.filter("0- Overall");
dc.redrawAll();
dc.renderAll();
/* Customised infobox */
d3.selectAll("g.row").call(rowTip);
d3.selectAll("g.row").on('mouseover', rowTip.show).on('mouseout', rowTip.hide);
var stackChart = 'div#gapReceived.dc-chart rect';
d3.selectAll(stackChart).call(barTip);
d3.selectAll(stackChart).on('mouseover', barTip.show).on('mouseout', barTip.hide);
}
);
</script>
<script src="js/bootstrap.js"></script>
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://data.unhcr.org/piwik/" : "http://data.unhcr.org/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 14);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://data.unhcr.org/piwik/piwik.php?idsite=14" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
</body>
</html>