-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
626 lines (567 loc) · 36.2 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
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
<!DOCTYPE html>
<!-- Sector Dashboard -->
<html lang="en">
<head>
<title>Protection Dashboard </title>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" name="viewport" />
<meta content="UNHCR Information management" name="author" />
<meta content="Protection Cluster" property="og:title" />
<meta content="article" property="og:type" />
<meta content="https://github.com/protection-cluster/dashboard-monitoring-template" property="og:url" />
<meta content="https://github.com/protection-cluster/dashboard-monitoring-template/images/Protectiondashboard.jpg" property="og:image" />
<meta content="Protection Cluster" property="og:site_name" />
<meta content="Protection Cluster" property="og:description" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<!-- Bootstrap with Yeti them from bootswatch-->
<link rel="stylesheet" href="./css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="./css/bootswatch.min.css" type="text/css" >
<link rel="stylesheet" href="./css/font-humanitarian.css" type="text/css" >
<link rel="stylesheet" href="./css/dc.css" type="text/css" />
<link href="./css/dashboard.css" rel="stylesheet" type="text/css" />
<!-- Add IntroJs styles and JS -->
<link href="./css/introjs.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/intro.js"></script>
<script type="text/javascript" src="./js/monthlyReport.js"> </script>
<script src="./js/jquery.js"></script>
<!-- map the data to the GeoJSON object -->
<script src="./js/data-jo.js"></script>
<link href="./img/coordination.ico" rel="icon" type="image/x-icon">
<!-- HTML5 shim, for IE6-8 support of HTML elements--><!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<div class="container-fluid" id="dashboard">
<div class="row" style="background-color: #33a3dc; color: #ffffff">
<div class="col-md-1">
<center >
<i class="icon-new-sector-protection" style="color:white; font-size:100px;" ></i>
</center>
</div>
<div class="col-md-7">
<!-- <center> </center> -->
<h3><strong>Protection Working Group
| <a href="index.html" target="_blank"><i class="icon-im-coord" style="color:white; font-size:20px;" ></i></a></strong></h3>
The data presented here are cleared by Sector focal points.
You can donwload the <a href="./data/data.csv" target="_blank">data here</a>.<br />
<strong>The following charts shows the achievement of the Protection sector. Click on any of the graphs below to filter and slice the data.</strong>
<p>The units displayed here corresponds to "Assistance Instance". As such totals presented here should be analysed with caution. </p>
</div>
<div class="col-md-4">
<div class="row" >
<div class="socialmedia" data-step="11" data-intro="Feel Free to share if you like it!" data-position="left">
<table width = "100%">
<tbody>
<tr>
<td valign="middle"><a href="http://www.facebook.com/sharer.php?u=https://github.com/protection-cluster/dashboard-monitoring-template" target="_blank">
<img src="./img/Facebook.png" style="height: 25px; width: 25px"></a></td>
<td valign="middle"><a href="https://twitter.com/intent/tweet?url=https://github.com/protection-cluster/dashboard-monitoring-template&text=%23cluster" target="_blank">
<img src="./img/Twitter.png" style="height: 25px; width: 25px"></a></td>
<td valign="middle"><a href="https://plus.google.com/share?&hl=en&url=https://github.com/protection-cluster/dashboard-monitoring-template" target="_blank">
<img src="./img/Google.png" style="height: 25px; width: 25px"></a></td>
</tr>
</tbody></table><br>
</div>
</div>
<div class="row" >
<p>
<b>Leading Agencies:</b> <i>UNHCR</i> <a href="mailto:[email protected]"> Name </a> &
<i>Name</i> <a href="mailto:[email protected]"> Name </a><br>
<small>The Protection Sector includes the following sub-sectors:
Child Protection <a href="mailto:[email protected]"> Name </a> -
SGBV <a href="mailto:[email protected]"> Name </a> -
Mental Health and Psychosocial Support <a href="mailto:[email protected]"> Name </a>
</small> </p>
</p>
<br>
<div class="dc-chart" id="count-info" data-step="12" data-intro="Click on this button to clear all the filters." data-position="right">
<strong><span class="filter-count " ></span></strong> selected out of <span class="total-count "></span> records</div>
<a class="reset btn btn-primary btn-sm" id="reset" href="javascript:dc.filterAll();dc.redrawAll();">Reset All Filters</a>
<a class="reset btn btn-primary btn-sm" href="indexInd.html"> Indic View </a>
<a class="btn btn btn-success" href="javascript:void(0);" onclick="javascript:introJs().start();">Tutorial</a> <br >
</div>
</div>
</div>
<div class="row" >
<div class="tab-pane fade active in" id="Overview">
<div class="row">
<div class="col-md-3">
<div class="row">
<center>
<div class="dc-chart" data-intro="Click on this row chart to filter by Activity." data-position="right" data-step="1" id="obj">
</div>
<div class="dc-chart" data-intro="Click on this row chart to filter by Activity." data-position="right">
<center>
<br>
<a id="reset" class="reset btn btn-primary btn-sm" href='javascript:dc.filterAll(); obj_chart.filter("SGBV"); dc.redrawAll();'> SGBV </a>
<a id="reset" class="reset btn btn-primary btn-sm" href='javascript:dc.filterAll(); obj_chart.filter("CP"); dc.redrawAll();'> CP </a>
<a id="reset" class="reset btn btn-primary btn-sm" href='javascript:dc.filterAll(); obj_chart.filter("MHPSS"); dc.redrawAll();'> MHPSS </a>
<a id="reset" class="reset btn btn-primary btn-sm" href='javascript:dc.filterAll(); obj_chart.filter("PROT"); dc.redrawAll();'> Protection </a>
</center>
</div>
</center>
</div>
<div class="row">
<center>
<div class="dc-chart" data-intro="Click on this row chart to filter by Indicator." data-position="right" data-step="1" id="indicator">
<center>
<h5><strong>Indicator</strong><br ><small># of assistance instance</small></h5>
</center>
</div>
</center>
</div>
<div class="row">
<div class="col-md-6">
<center>
<div class="dc-chart" data-intro="Click on this pie chart to filter by Population Cohort." data-position="right" data-step="2" id="gender">
<center>
<h5><strong>Age Group & Gender</strong><br ><small># of assistance instance</small></h5>
</center>
</div>
</center>
</div>
<div class="col-md-6">
<center>
<div class="dc-chart" data-intro="Click on this pie chart to filter by Population Cohort." data-position="right" data-step="2" id="poptype">
<center>
<h5><strong>Population Type</strong><br ><small># of assistance instance</small></h5>
</center>
</div>
</center>
</div>
</div>
<div class="row">
<center>
<div class="dc-chart" data-intro="Click on this row chart to filter by RRP6 status of the report." data-position="right" data-step="4" id="appeal">
<center>
<h5><strong>Inter Agency Appeal</strong><br ><small># of assistance instance</small></h5>
</center>
</div>
</center>
</div>
</div>
<div class="col-md-3">
<div class="row">
<center>
<div class="dc-chart" data-intro="Click on this row chart to filter by Partner." data-position="right" data-step="5" id="partner">
<center>
<h5><strong>Partner</strong><br ><small># of assistance instance</small></h5>
</center>
</div>
</center>
</div>
<div class="row">
<center>
<div class="dc-chart" data-intro="Click on this row chart to filter by Site Type." data-position="right" data-step="6" id="allocation">
<center>
<h5><strong>Allocation according to Initial Plan</strong><br ><small># of assistance instance</small></h5>
</center>
</div>
</center>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6" >
<center>
<div class="dc-chart" data-intro="Click on this pie chart to filter by Funding Agency." data-position="right" data-step="3" id="funded">
<center>
<h5><strong>Funding Agency</strong><br ><small># of assistance instance</small></h5>
</center>
</div>
<div class="dc-chart" data-intro="Click on this pie chart to filter by Funding Agency." data-position="right" data-step="10" id="location">
<center>
<h5><strong>Top Locations </strong> <br> <small>Camps locations are not aggregated within Governorate</small></h5>
</center>
</div>
<div class="dc-chart" data-intro="Click on this pie chart to filter by Funding Agency." data-position="right" data-step="11" id="obj">
</div>
</center>
</div>
<div class="col-md-6"
data-intro="Click anywhere on the map to filter the results. The camp icon filters activities for camp only and the small jordan map filters country-wide activities" data-position="left" data-step="8" >
<div id="region">
<h5><strong>Governorates</strong><br >
<small>Some activities are country-wide or for camps only.</small></h5>
</div>
</div>
</div>
<div class="row">
<center>
<h5><strong>Monthly Progress</strong><br ><small># of assistance instance</small></h5>
</center>
<script type="text/javascript">
var d = new Date();
var n = d.getMonth();
n = 12; // Patch for 2016 12 Months
for(count = 0; count < n; count++){
var o = count + 1;
document.write('<a id="reset" class="reset btn btn-primary btn-sm" href="javascript:dc.filterAll(); monthrange_chart.filter([new Date(2016,' + count + ', 1), new Date(2016, ' + o + ', 31)]); dc.redrawAll();">');
document.write(monthNames[count] + "</a> ");
}
</script>
<br>
<div class="col-md-12 dc-chart" data-intro="Click on this line chart to zoom in to specific Month." data-position="left" data-step="9" id="month">
</div>
</div>
<div class="row">
<div class="col-md-12 dc-chart" data-intro="Click on this bar chart to filter by Range of Month(s)." data-position="left" data-step="10" id="monthrange">
<center>
<h5><strong>Select Month Range Here</strong></h5>
</center>
</div>
</div>
</div>
</div>
<div class="row" >
<div class="col-md-12">
<p><h2> </h2></p>
</div>
</div>
</div>
<div class="tab-pane fade" id="PerIndicator">
<p>This is the sector overview</p>
</div>
</div>
<div class="row" style="background-color: #33a3dc; color: #00000">
<div class="col-md-12">
<p><strong>Produced by Protection Cluster Information Management Unit.</p>
</div>
</div>
</div>
<script type="text/javascript" src="./js/d3_002.js">
</script><!--script type="text/javascript" src="js/d3.v3.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.js"></script>
<script>
// loading screen code
$(window).load(function() {
$(".loader").fadeOut("slow");
});
//GeoJSON data for background map
var width = 360;
var height = 360;
var svg = d3.select("#region")
.append("svg")
.attr("width", width)
.attr("height", height)
.style("stroke-width", "0")
.style("stroke", "grey");
d3.json("./data/admin1.geojson", function(json) {
var center = d3.geo.centroid(json)
var scale = 150;
var offset = [width/2, height/2];
var projection = d3.geo.mercator().scale(scale).center(center).translate(offset);
var path = d3.geo.path().projection(projection);
var bounds = path.bounds(json);
var hscale = scale*(width) / (bounds[1][0] - bounds[0][0]);
var vscale = scale*(height - 75)/ (bounds[1][1] - bounds[0][1]);
var scale = (hscale < vscale) ? hscale : vscale;
var offset = [width - (bounds[0][0] + bounds[1][0])/2, height - (bounds[0][1] + bounds[1][1])/2];
path.projection(d3.geo.mercator().center([42,29.9]).scale(3500))
svg.append("rect").attr('width', width).attr('height', height).style('stroke', 'black').style('fill', 'none');
svg.selectAll("path").data(json.features).enter().append("path").attr("d", path).style("fill", "white").style("stroke-width", "1").style("stroke", "black")
});
//Prepare to load data
var dataset;
var indicator_chart = dc.rowChart("#indicator");
var gender_chart = dc.pieChart("#gender");
var poptype_chart = dc.pieChart("#poptype");
var funded_chart = dc.rowChart("#funded");
var appeal_chart = dc.rowChart("#appeal");
var allocation_chart = dc.rowChart("#allocation");
var partner_chart = dc.rowChart("#partner");
var month_chart = dc.lineChart("#month");
var monthrange_chart = dc.barChart("#monthrange");
var location_chart = dc.rowChart("#location");
var obj_chart = dc.rowChart("#obj");
var region_chart = dc.bubbleOverlay("#region").svg(d3.select("#region svg"));
function getFiltersValues() {
var filters = [
{ name: 'indicator', value: indicator_chart.filters()},
{ name: 'gender', value: gender_chart.filters()},
{ name: 'poptype', value: poptype_chart.filters()},
{ name: 'funded', value: funded_chart.filters()},
{ name: 'appeal', value: appeal_chart.filters()},
{ name: 'partner', value: partner_chart.filters()},
{ name: 'allocation', value: allocation_chart.filters()},
{ name: 'monthrange', value: monthrange_chart.filters()},
{ name: 'location', value: location_chart.filters()},
{ name: 'obj', value: obj_chart.filters()},
{ name: 'region', value: region_chart.filters()}
];
var recursiveEncoded = $.param( filters );
location.hash = recursiveEncoded;
}
function initFilters() {
// Get hash values
var parseHash = /^#indicator=([A-Za-z0-9,_\-\/\s]*)&gender=([A-Za-z0-9,_\-\/\s]*)&funded=([A-Za-z0-9,_\-\/\s]*)&rrp6=([A-Za-z0-9,_\-\/\s]*)&partner=([A-Za-z0-9,_\-\/\s]*)&AllocationRRP6=([A-Za-z0-9,_\-\/\s]*)&Governorate=([A-Za-z0-9,_\-\/\s]*)$/;
var parsed = parseHash.exec(decodeURIComponent(location.hash));
function filter(chart, rank) {
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(indicator_chart, 1);
filter(gender_chart, 2);
filter(funded_chart, 3);
filter(appeal_chart, 4);
filter(partner_chart, 5);
filter(allocation_chart, 6);
filter(allocation_chart, 7);
filter(poptype_chart, 8);
filter(region_chart, 9);
filter(obj_chart, 10);
}
}
d3.csv("./data/data.csv", function(error, dataset) {
var dateFormat = d3.time.format("%d/%m/%Y");
var numberFormat = d3.format(",f");
dataset.forEach(function (d) {
d.dd = dateFormat.parse(d.StartDate);
d.month = d3.time.month(d.dd); // pre-calculate month for better performance
d.close = +d.close; // coerce to number
d.open = +d.open;
});
if (error) { //If error is not null, something went wrong.
console.log(error); //Log the error.
} else { //If no error, the file loaded correctly. Yay!
//console.log(dataset); //Log the data.
var cf = crossfilter(dataset);
cf.indicator = cf.dimension(function(d) { return d.Indicator; });
var indicator = cf.indicator.group();
var indicatorByTotal = cf.indicator.group().reduceSum(function (d) { return d.Value;} );
indicator_chart.width(400).height(250)
.dimension(cf.indicator)
.group(indicatorByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(10); })
.colors(['#33a3dc'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.gender = cf.dimension(function(d) { return d.Gender; });
var gender = cf.gender.group();
var genderByTotal = cf.gender.group().reduceSum(function (d) { return d.Value;} );
gender_chart.width(100).height(100)
.dimension(cf.gender)
.group(genderByTotal)
.innerRadius(10)
.colors(['#33a3dc', /* boys */
'#85C8EA', /* girls */
'#006687', /* men*/
'#1A99D9', /* women */
])
.colorDomain([0,4])
.renderLabel(true)
.colorAccessor(function(d, i){return i%4;})
.on("filtered", getFiltersValues);
cf.poptype = cf.dimension(function(d) { return d.poptype; });
var poptype = cf.poptype.group();
var poptypeByTotal = cf.poptype.group().reduceSum(function (d) { return d.Value;} );
poptype_chart.width(100).height(100)
.dimension(cf.poptype)
.group(poptypeByTotal)
.innerRadius(10)
.colors(['#33a3dc',
'#85C8EA',
'#006687',
])
.colorDomain([0,4])
.renderLabel(true)
.colorAccessor(function(d, i){return i%4;})
.on("filtered", getFiltersValues);
cf.funded = cf.dimension(function(d) { return d.Fundedby; });
var funded = cf.funded.group();
var fundedByTotal = cf.funded.group().reduceSum(function (d) { return d.Value;} );
funded_chart.width(400).height(175)
.dimension(cf.funded)
.group(fundedByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(100); })
.colors(['#33a3dc'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.location = cf.dimension(function(d) { return d.Governorate; });
var location = cf.location.group();
var locationByTotal = cf.location.group().reduceSum(function (d) { return d.Value;} );
location_chart.width(400).height(175)
.dimension(cf.location)
.group(locationByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(6); })
.colors(['#33a3dc'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.obj = cf.dimension(function(d) { return d.activity; });
var obj = cf.obj.group();
var objByTotal = cf.obj.group().reduceSum(function (d) { return d.Value;} );
obj_chart.width(1).height(1)
.dimension(cf.obj)
.group(objByTotal)
.elasticX(false)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(10); })
.colors(['#33a3dc'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.appeal = cf.dimension(function(d) { return d.appeal; });
var appeal = cf.appeal.group();
var appealByTotal = cf.appeal.group().reduceSum(function (d) { return d.Value;} );
appeal_chart.width(400).height(130)
.dimension(cf.appeal)
.group(appealByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(100); })
.colors(['#33a3dc'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.allocation = cf.dimension(function(d) { return d.allocation; });
var allocation = cf.allocation.group();
var allocationByTotal = cf.allocation.group().reduceSum(function (d) { return d.Value;} );
allocation_chart.width(400).height(90)
.dimension(cf.allocation)
.group(allocationByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(100); })
.colors(['#33a3dc'])
.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 partner = cf.partner.group();
var partnerByTotal = cf.partner.group().reduceSum(function (d) { return d.Value;} );
partner_chart.width(400).height(570)
.dimension(cf.partner)
.group(partnerByTotal)
.elasticX(true)
.on("filtered", getFiltersValues)
.data(function(group) { return group.top(200); })
.colors(['#33a3dc'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
cf.month = cf.dimension(function (d) {return d.dd;});
var month = cf.month.group();
var monthByTotal = cf.month.group().reduceSum(function (d) { return d.Value;} );
var boys=cf.month.group().reduceSum(function(d) {if (d.Gender=="Boys") {return d.Value;}else{return 0;}});
var girls=cf.month.group().reduceSum(function(d) {if (d.Gender=="Girls") {return d.Value;}else{return 0;}});
var men=cf.month.group().reduceSum(function(d) {if (d.Gender=="Men") {return d.Value;}else{return 0;}});
var women=cf.month.group().reduceSum(function(d) {if (d.Gender=="Women") {return d.Value;}else{return 0;}});
month_chart.width(900).height(230)
.transitionDuration(1000)
.margins({top: 30, right: 50, bottom: 25, left: 60})
.dimension(cf.month)
.mouseZoomable(true)
.rangeChart(monthrange_chart)
.x(d3.time.scale().domain([new Date(2016, 0, 1), new Date(2016, 11, 31)]))
.xUnits(d3.time.months)
//.elasticY(true)
.renderHorizontalGridLines(true)
.legend(dc.legend().x(700).y(10).itemHeight(13).gap(5))
.brushOn(false)
.group(boys, 'Boys')
.stack(girls, 'Girls')
.stack(men, 'Men')
.stack(women, 'Women')
.renderArea(false);
monthrange_chart.width(900)
.height(40)
.margins({top: 0, right: 50, bottom: 20, left: 60})
.dimension(cf.month)
.group(monthByTotal)
.colors(['#33a3dc'])
.gap(1)
.x(d3.time.scale().domain([new Date(2016, 0, 1), new Date(2016, 11, 31)]))
.xUnits(d3.time.months)
.yAxis().ticks(0);
// Now create the buble chart for all region
cf.region = cf.dimension(function(d) { return d.Governorate; });
var region = cf.region.group();
var regionByTotal = cf.region.group().reduceSum(function (d) { return d.Value;} );
region_chart.width(400).height(400)
.transitionDuration(500)
.dimension(cf.region)
.group(regionByTotal)
.colors(['#215968'])
.colorDomain([0, 0])
.colorAccessor(function(d, i){return 1;})
.title(function(d) { return "region: " + d.key + "\nTotal:" + d.value;})
// .radiusValueAccessor(function (p) { return p.value; })
// .maxBubbleRelativeSize(0.03)
.r(d3.scale.linear().domain([0, 500000]))
.point("IRBID", 98, 58)
.point("MAFRAQ", 193, 70)
.point("ZARQA", 160, 108)
.point("AMMAN", 130, 120)
.point("MAAN", 120, 230)
.point("AQABAH", 70, 260)
.point("TAFILAH", 90, 180)
.point("KARAK", 100, 155)
.point("MADABA", 95, 130)
.point("BALQA", 94, 96)
.point("JARASH", 104, 82)
.point("AJLOUN", 74, 96)
.point("ZaatariCamp", 270, 150)
.point("AzraqCamp", 270, 180)
.point("EJ Camp", 270, 210)
.point("Countrywide", 255, 260)
.on("filtered", getFiltersValues)
// .debug(true)
;
var all = cf.groupAll();
dc.dataCount("#count-info")
.dimension(cf)
.group(all);
cf.region = cf.dimension(function(d) { return d.region; });
var region = cf.region.group();
dc.renderAll();
/* Customised infobox */
d3.selectAll("g.row").call(rowTip);
d3.selectAll("g.row").on('mouseover', rowTip.show).on('mouseout', rowTip.hide);
d3.selectAll(".pie-slice").call(pieTip);
// tooltips
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) + " Assistance Instance"; });
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) + " Assistance Instance"; });
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.value) + " Assistance Instance";});
var bubbleTip = d3.tip().attr('class', 'd3-tip').offset([-10, 0]).html(function (d) { return "<span style='color: #f0027f'>" + d.key + "</span> : " + numberFormat(d.value) + " Assistance Instance";});
//var geoTip = d3.tip().attr('class', 'd3-tip').offset([-10, 0]).html(function (d) { return "<span style='color: #f0027f'>" + cazacode2caza[d.key] + "</span> : " + numberFormat(d.value) + " Individuals";});
$('#dashboard').show();
}
});
</script>
<script src="js/bootstrap.js"></script>
<script>
// Script to initiate filtering on page at the right place
$(window).bind("load", function() {
if (GetUrlValue('Camp')=="Camp")
{
dc.filterAll(); location_chart.filter("Camp"); dc.renderAll();
}
var d = new Date();
var n = d.getMonth();
dc.filterAll();
monthrange_chart.filter([new Date(2016, n-1, 1), new Date(2016, n-1, 31)]);
dc.redrawAll();
});
</script>
<div class="d3-tip" style="box-sizing: border-box; position: absolute; display: none"> </div>
<div class="d3-tip" style="box-sizing: border-box; position: absolute; display: none"> </div>
<div class="d3-tip" style="box-sizing: border-box; position: absolute; display: none"> </div>
</div>
</body>
</html>