forked from unhcr-xborder-turkey/ISIMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex - Backup.html
910 lines (738 loc) · 34.7 KB
/
index - Backup.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
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" name="viewport">
<meta name="author" content="Mattia Zanazzi (credit for original dashboard to: Edouard Legoupil)">
<title>ISIMM - CCCM Cluster Syria (Northern Governorates)</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/vnd.microsoft.icon" />
<meta itemprop="name" content="ISIMM - CCCM Cluster Syria (Northern Governorates)"/>
<meta itemprop="description" content="ISIMM - CCCM Cluster Syria (Northern Governorates)"/>
<meta property="og:title" content="ISIMM - CCCM Cluster Syria (Northern Governorates)">
<meta property="og:type" content="article">
<meta property="og:url" content="https://zanmat.github.io/ISIMM/">
<meta property="og:image" content="https://zanmat.github.io/ISIMM/ISIMM.jpg">
<meta property="og:site_name" content="ISIMM - CCCM Cluster Syria (Northern Governorates)">
<meta property="og:description" content="ISIMM - CCCM Cluster Syria (Northern Governorates)">
<link type="text/css" href="css/leaflet.css" rel="stylesheet"/>
<link type="text/css" href="css/leaflet.markercluster.css" rel="stylesheet"/>
<!-- Bootstrap -->
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/dc.css">
<!-- Add IntroJs styles -->
<link rel="stylesheet" type="text/css" href="css/introjs.css">
<link rel="stylesheet" type="text/css" href="css/dashboard.css">
</head>
<body>
<div style="display: none;" class="col-sm-4 col-md-offset4" id="loading">
<h1>Patience: We are wrapping up the data... </h1><small>This webpage does not work on IE8 or older... Upgrade your browser if needed</small>
</div>
<div style="display: block;" class="container" id="dashboard">
<div class="col-xs-12">
<a href="https://www.humanitarianresponse.info/en/operations/stima/camp-coordination-management" target="_blank">
<img src="images/ISIMM.png" style="width: 100%"></a>
</div>
<div class="col-xs-12"><!--Explore the profile of IDP sites in Northern Syria. You can download the data <a href="data/dataviz.tsv" target="_blank">here</a> and access the full map <a href="https://ona.io/iraqcccm/forms/baseline/map" target="_blank" >here</a> -->
<div class="socialmedia" data-step="9" data-intro="Share this visualisation on twitter!" data-position="left">
</div>
<div class="row" >
<div class="col-md-2" align="center">
<a class="btn btn btn-success" href="javascript:void(0);" onclick="javascript:introJs().start();">How-To</a>
</div>
<div class="col-md-5" align="center">
<h4>Filter on conditions within the sites</h4>
</div>
<div class="col-md-2" data-step="1" data-intro="Use the reset button at any time to delete all your filters" data-position="center">
<div class="col-md-1" align="center">
<a class="reset btn btn-primary btn-sm" id="reset" href="#">Reset All</a>
</div>
</div>
</div>
<!--
-->
<div class="row" id="cccm" data-step="2" data-intro="Click on the pie charts to filter the sites per condition type. You can select more than one criteria to filter! Just click one after the other." align="center">
<p style="font-size:85%;"> % of total IDP population:
<span style="color: #2572ad;"> 1. Fully covered </span>/ <span style="color: #4D9CD8;">2. Mostly covered </span> / <span style="color: #FC7E77;">3. Partially covered </span> / <span style="color: #de4c44;">4. Not covered - Information unavailable</span> </p>
<div class="col-md-15" >
<div class="shelter" id="cccm" class="dc-chart" >
<p><small>Shelter</small></p>
</div>
</div>
<div class="col-md-15" >
<div class="waterp" id="cccm" class="dc-chart" >
<p><small>Water</small></p>
</div>
</div>
<div class="col-md-15" >
<div class="sanitation" id="cccm" class="dc-chart" >
<p><small>Sanitation</small></p>
</div>
</div>
<div class="col-md-15" >
<div class="waster" id="cccm" class="dc-chart" >
<p><small>Waste Removal</small></p>
</div>
</div>
<div class="col-md-15" >
<div class="NFI" id="cccm" class="dc-chart" >
<p><small>NFI</small></p>
</div>
</div>
<div class="col-md-15" >
<div class="food" id="cccm" class="dc-chart" >
<p><small>Food</small></p>
</div>
</div>
</div>
<div class="row" align="center" data-step="3" data-intro="All of these charts display information based on the number of individuals by location. Again, you can combine as many filters as you want."> <h4>Filter on location, status and composition of the sites</h4>
<p style="font-size:85%;" align="center">
<i>All charts relate to number of individuals. </i> </p>
<div class="row" id="cccm">
<div class="col-md-2" >
<div class="governoratep" class="col-xs-6 dc-chart" data-step="4" data-intro="Click on this bar chart to filter by governorate." data-position="right" align="center">
<h4>Governorates</h4>
</div>
<div class="districtp" class="dc-chart" data-step="5" data-intro="Click on this bar chart to filter by district" >
<h4>Districts</h4>
</div>
</div>
<div class="col-md-2" data-step="6" data-intro="Click on this bar chart to filter by Camp Cluster" align="center">
<div class="scorep" id="cccm" class="dc-chart" align="center">
<h4>Camp Clusters</h4>
<p style="font-size:75%;" align="center"><i>A Camp Cluster refers to a group of IDP sites in close proximity with high levels of collaboration among member agencies. </i></p>
</div>
</div>
<div class="col-md-13" >
<div class="environmentp" id="cccm" class="dc-chart" align="center" data-step="7" data-intro="Click on this pie chart to filter by number of individuals residing in Informal Settlements, Transit Centres or Planned camps." data-position="center">
<h4>Site type</h4>
<p style="font-size:75%;"><i>IS: Informal Settlement, TC: Transit Centre,<br> PC: Planned camp </i></p>
</div>
<div id="count-info" align="center" data-step="8" data-intro="As you select your categories for filtering, this field will provide the total individuals with a breakdown by men, women, boys and girls in your selection. This breakdown does not necessarily add up to the sum, as some data might be missing.">
<br><br>
<h4>Current Selection</h4>
<p>
<span style="font-size:90%">
<strong> <span class="filter-count"></span></strong> sites selected out of <strong><span class="total-count"></span></strong>. <br> <br>
<span id="totalind" class="number-display"></span> individuals, of which: <br>
<!--
<span id="totalhou" class="number-display"></span> household, -->
<span id="totalmen" class="number-display" ></span> men <br>
<span id="totalwom" class="number-display"></span> women <br>
<span id="totalboy" class="number-display"></span> boys <br>
<span id="totalgirl" class="number-display"></span> girls
<br><br>
</span>
</p>
</div>
</div>
<div class="col-md-14" data-step="9" data-intro="Click or zoom on the map to filter by site">
<div align="center"> <h4>Map: Location of the sites</h4>
<p><small><i>For security reasons, please note that site coordinates are purposely imprecise. <br>
For further information, please contact the <a href="mailto:[email protected]?Subject=ISIMM%20Information%20Request" target="_top"> CCCM Cluster</a>.
</i></small></p></div>
<div class="map" id="cccm" align="left"> </div>
</div>
</div>
</div>
<!-- <div class="row" id="cccm" >
<div class="col-md-3" >
<div class="householdnump" id="cccm" class="dc-chart" >
<h4>Individuals / Households</h4>
<p><small><i>Average number of individuals per household per site</i></small></p>
</div>
</div>
<div class="col-md-9" >
<h4>Filter on Shelter type within the sites</h4>
<p><small><i>Based on site observation by enumerators</i></small></p>
<div class="col-md-3" >
<div class="unfinishedp" id="cccm" class="dc-chart" >
<p><small>Sites that include <strong>unfinished buildings</strong> (buildings under construction)</small></p>
</div>
</div>
<div class="col-md-3" >
<div class="opensitep" id="cccm" class="dc-chart" >
<p><small>Sites that include <strong>open accommodations</strong> (tents or any improvised shelter)</small></p>
</div>
</div>
</div>
</div>
<div class="row" id="cccm" data-step="8" data-intro="Filter results by particpation organisation" data-position="left">
<h4>Participating Organisations</h4>
<div class="col-md-8">
<p> The CCCM cluster coordinates work on the ground from various organisations.<br >
This assessment has been made possible through the contribution of various partners.</p>
<table>
<tbody>
<tr>
<td valign="middle">
<a href="http://drc.dk/relief-work/where-we-work/middle-east/iraq/" target="_blank">
<img src="images/partner/drc.jpg" ></a>
</td>
<td valign="middle">
<a href="http://www.ifrc.org/en/news-and-media/press-releases/middle-east-and-north-africa/iraq/" target="_blank">
<img src="images/partner/frc.jpg" ></a>
</td>
<td valign="middle">
<a href="http://www.harikar.org/new/" target="_blank">
<img src="images/partner/harikar.jpg" ></a>
</td>
</tr>
<tr>
<td valign="middle">
<a href="http://iomiraq.net/news" target="_blank">
<img src="images/partner/iom.jpg" ></a>
</td>
<td valign="middle">
<a href="http://www.reach-initiative.org/tag/iraq" target="_blank">
<img src="images/partner/reach-initiative.jpg" ></a>
</td>
<td valign="middle">
<a href="http://www.unhcr.org/pages/49e486426.html" target="_blank">
<img src="images/partner/unhcr.jpg" ></a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="orgap" class="col-md-4 dc-chart" >
<p><small>Number of sites assessed per organisation (based on phase 1 assessment, new sites assessed by REACH)</small></p>
</div>
</div>
-->
<!--
<div class='row'>
<div class='col-md-12'>
<table class='table table-hover' id='dc-table-graph'>
<thead>
<tr class='header'>
<th>Governorates</th>
<th>District</th>
<th>Household (num)</th>
<th>Individual(num)</th>
</tr>
</thead>
</table>
</div>
</div>
<div class="row" id="cccm" data-position="left">
<div class="col-md-14" align="center">
<div class="camps" class="col-md-4 dc-chart" > <h4>Test</h4> </div>
</div>
</div>
-->
<div class="row">
<div class="col" align="left"> <small><a href="https://github.com/unhcr-iraq/Site-Assessment" target="_blank">Credit</a></small></div>
<div class="col" align="right">
<a href="https://twitter.com/intent/tweet?url=https://zanmat.github.io/ISIMM/" target="_blank"><img src="images/Twitter.png" style="height: 20px; width: 20px"></a>
</div>
</div>
</div>
<script type="text/javascript" src="js/intro.js"></script>
<script type="text/javascript" src="js/d3_002.js"></script>
<script type="text/javascript" src="js/d3.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/jquery.js"></script>
<!--maps-->
<script type="text/javascript" src="js/leaflet.js"></script>
<script type="text/javascript" src="js/leaflet.markercluster.js"></script>
<script type="text/javascript" src="js/dc.leaflet.js"></script>
<script type="text/javascript">
/* Markers */
var numberFormat = d3.format(",f");
d3.csv("data/ISIMM4.csv", function(data) {
// drawMarkerSelect(data);
drawMarkerArea(data);
});
/*
function regroup(dim, cols) {
var _groupAll = dim.groupAll().reduce(
function(p, v) { // add
cols.forEach(function(c) {
p[c] += v[c];
});
return p;
},
function(p, v) { // remove
cols.forEach(function(c) {
p[c] -= v[c];
});
return p;
},
function() { // init
var p = {};
cols.forEach(function(c) {
p[c] = 0;
});
return p;
});
return {
all: function() {
// or _.pairs, anything to turn the object into an array
return d3.map(_groupAll.value()).entries();
}
};
}
*/
function drawMarkerArea(data) {
//function drawMarkerSelect(data) {
/*
data = [];
data.filter(function(d) {
return d.geo;
}).forEach(function(d) {
d.geo = d.geo.split(",");
d.sitear=+d.sitear;
d.neighbourhood=+d.neighbourhood;
d.marker = new L.Marker(new L.LatLng(d.geo[0], d.geo[1]),{
title: d.sitear,
icon: new L.icon({"iconUrl":d.iconUrl,iconSize:[32, 32],iconAnchor:[16,0]}),
clickable: true,
draggable: false
});
d.marker.data=d;
});
delete data;
*/
function remove_empty_bins(source_group) {
return {
all:function () {
return source_group.all().filter(function(d) {
return d.value != 0;
});
}
};
}
var xf = crossfilter(data);
var groupname = "marker-select";
var all = xf.groupAll();
dc.dataCount("#count-info",groupname)
.dimension(xf)
.group(all);
var byIndividual = xf.dimension(function(d) { return d.individual; });
var byIndividualGroup = byIndividual.groupAll().reduceSum(function (d) { return d.individual; });
dc.numberDisplay("#totalind",groupname)
.valueAccessor(function(d){return +d})
.group(byIndividualGroup);
var byHousehold = xf.dimension(function(d) { return d.household; });
var byHouseholdGroup = byHousehold.groupAll().reduceSum(function (d) { return d.household; });
dc.numberDisplay("#totalhou",groupname)
.valueAccessor(function(d){return +d})
.group(byHouseholdGroup);
var byMen = xf.dimension(function(d) { return d.men; });
var byMenGroup = byMen.groupAll().reduceSum(function (d) { return d.men; });
dc.numberDisplay("#totalmen",groupname)
.valueAccessor(function(d){return +d})
.group(byMenGroup);
var byWomen = xf.dimension(function(d) { return d.women; });
var byWomenGroup = byWomen.groupAll().reduceSum(function (d) { return d.women; });
dc.numberDisplay("#totalwom",groupname)
.valueAccessor(function(d){return +d})
.group(byWomenGroup);
var byBoy = xf.dimension(function(d) { return d.boys; });
var byBoyGroup = byBoy.groupAll().reduceSum(function (d) { return d.boys; });
dc.numberDisplay("#totalboy",groupname)
.valueAccessor(function(d){return +d})
.group(byBoyGroup);
var byGirl = xf.dimension(function(d) { return d.girls; });
var byGirlGroup = byGirl.groupAll().reduceSum(function (d) { return d.girls; });
dc.numberDisplay("#totalgirl",groupname)
.valueAccessor(function(d){return +d})
.group(byGirlGroup);
/*
var byMen = xf.reduceSum(function (d) { return d.men; });
var byWomen = xf.reduceSum(function (d) { return d.women; });
var byBoy = xf.reduceSum(function (d) { return d.boys; });
var byGirl = xf.reduceSum(function (d) { return d.girls; });
*/
/*
dc.numberDisplay("#totalhous",groupname)
.dimension(byMen)
*/
var facilities = xf.dimension(function(d) { return d.camp_name; });
var facilitiesGroup = facilities.group().reduce(
function(p, v) { // add
p.individual = v.individual;
p.geo = v.geo;
++p.count;
return p;
},
function(p, v) { // remove
--p.count;
return p;
},
function() { // init
return {count: 0};
}
);
dc.leafletMarkerChart("#cccm .map",groupname)
.dimension(facilities)
.group(facilitiesGroup)
.width(540)
.height(440)
.center([36.0503,37.6385])
.zoom(7)
.cluster(true)
// .filterByArea(true)
// .featureKeyAccessor(function(feature) {return feature.properties.geo; })
.renderPopup(true)
.valueAccessor(function(kv) {
return kv.value.count;
})
.locationAccessor(function(kv) {
return kv.value.geo;
})
.popup(function(kv) {
return kv.key + " : " + kv.value.individual;
});
/*
var facilities = xf.dimension(function(d) { return d.geo; });
var facilitiesGroup = facilities.group().reduceCount();
// var labelmap = xf.dimension(function(d) {return d.camp_name});
// var xtr = function(d,feature) { return feature.camp_name +" : "+feature.individual; };
dc.leafletMarkerChart("#cccm .map",groupname)
.dimension(facilities)
.group(facilitiesGroup)
.width(540)
.height(440)
.center([36.0503,37.6385])
.zoom(7)
.cluster(true)
.filterByArea(true)
// .featureKeyAccessor(function(feature) {return feature.properties.geo; })
.renderPopup(false)
// .popup(function(d,feature) {
// return feature.properties.camp_name+" : "+d.value;
// })
var pop = l.popup()
.setcontent("Test")
.openOn(map);
.popup(function(d) { return d.cluster+" : "+d.individual; });
//sitear neighbourhood organisat governorate district photo environment phone household men women boys girls individual
//.clusterObject({ maxClusterRadius: 40, disableClusteringAtZoom:10,spiderfyOnMaxZoom: false,showCoverageOnHover: false})
// .popup();
*/
//water_access water_quality electric openelement damage hazards mines fighting
var colorScale = d3.scale.ordinal()
.domain(["1. Fully covered", "2. Mostly covered", "3. Partially covered", "4. Not covered - N/A"])
.range(["#2572ad", "#4D9CD8", "#FC7E77", "#de4c44"]);
var colorScale2 = d3.scale.ordinal()
.domain(["IS", "PC", "TC", "CC"])
.range(["#2a87cf", "#56A2DC", "#88BEE7", "#BBDAF1"]);
var openelements = xf.dimension(function(d) { return d.shelter_cat; });
var openelementsGroup = openelements.group().reduceSum(function (d) { return d.individual; });
dc.pieChart("#cccm .shelter",groupname)
.dimension(openelements)
.group(openelementsGroup)
.width(75)
.height(75)
.renderLabel(false)
.label(function(d) { return Math.round((d.endAngle - d.startAngle) / Math.PI * 50) + '%';})
.renderTitle(true)
.colors(colorScale)
;
// .ordering(function (p) { return -p.value; });
var waters = xf.dimension(function(d) { return d.water_cat; });
var watersGroup = waters.group().reduceSum(function (d) { return d.individual; });
dc.pieChart("#cccm .waterp",groupname)
.dimension(waters)
.group(watersGroup)
.width(75)
.height(75)
.renderLabel(true)
.label(function(d) { return Math.round((d.endAngle - d.startAngle) / Math.PI * 50) + '%';})
.renderTitle(true)
.colors(colorScale)
.colorDomain([0,3,4]) ;
// .ordering(function (p) { return -p.value; });
var waterqs = xf.dimension(function(d) { return d.sanitation_cat; });
var waterqsGroup = waterqs.group().reduceSum(function (d) { return d.individual; });
dc.pieChart("#cccm .sanitation",groupname)
.dimension(waterqs)
.group(waterqsGroup)
.width(75)
.height(75)
.renderLabel(true)
.label(function(d) { return Math.round((d.endAngle - d.startAngle) / Math.PI * 50) + '%';})
.renderTitle(true)
.colors(colorScale)
.colorDomain(colorScale);
// .ordering(function (p) { return -p.value; });
var hazardss = xf.dimension(function(d) { return d.waste_cat; });
var hazardssGroup = hazardss.group().reduceSum(function (d) { return d.individual; });
dc.pieChart("#cccm .waster",groupname)
.dimension(hazardss)
.group(hazardssGroup)
.width(75)
.height(75)
.renderLabel(true)
.label(function(d) { return Math.round((d.endAngle - d.startAngle) / Math.PI * 50) + '%';})
.renderTitle(true)
.colors(colorScale)
.colorDomain(colorScale);
// .ordering(function (p) { return -p.value; });
var electrics = xf.dimension(function(d) { return d.NFI_cat; });
var electricsGroup = electrics.group().reduceSum(function (d) { return d.individual; });
dc.pieChart("#cccm .NFI",groupname)
.dimension(electrics)
.group(electricsGroup)
.width(75)
.height(75)
.renderLabel(true)
.label(function(d) { return Math.round((d.endAngle - d.startAngle) / Math.PI * 50) + '%';})
.renderTitle(true)
.colors(colorScale)
.colorDomain(colorScale);
// .ordering(function (p) { return -p.value; });
var miness = xf.dimension(function(d) { return d.Food_cat; });
var minessGroup = miness.group().reduceSum(function (d) { return d.individual; });
dc.pieChart("#cccm .food",groupname)
.dimension(miness)
.group(minessGroup)
.width(75)
.height(75)
.renderLabel(true)
.label(function(d) { return Math.round((d.endAngle - d.startAngle) / Math.PI * 50) + '%';})
.renderTitle(true)
.colors(colorScale)
.colorDomain(colorScale);
// .ordering(function (p) { return -p.value; });
/*
var fightings = xf.dimension(function(d) { return d.fighting; });
var fightingsGroup = fightings.group().reduceCount();
dc.pieChart("#cccm .fightingp",groupname)
.dimension(fightings)
.group(fightingsGroup)
.width(95)
.height(95)
.renderLabel(false)
.renderTitle(true)
.colors(colorScale)
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
*/
var environments = xf.dimension(function(d) { return d.environment; });
var environmentsGroup = environments.group().reduceSum(function (d) { return d.individual; }); //var governoratesByIndividual = governorates.group().reduceSum(function (d) { return d.individual; });
dc.pieChart("#cccm .environmentp",groupname)
.dimension(environments)
.group(environmentsGroup)
.width(175)
.height(175)
.renderLabel(true)
.renderTitle(true)
.colors(colorScale2)
.ordering(function (p) { return -p.value; });
var classs = xf.dimension(function(d) { return d.class; });
var classsGroup = classs.group().reduceCount();
dc.rowChart("#cccm .classp",groupname)
.dimension(classs)
.group(classsGroup)
.width(200)
.height(219)
.renderLabel(true)
.renderTitle(true)
.colors(['#2a87cf'])
.colorDomain([0,0])
.elasticX(true)
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
// .ordering(function (p) { return -p.value;});
/*
var types = xf.dimension(function(d) { return d.camp_name; });
var typesGroup = types.group().reduceSum(function (d) { return d.individual; });
dc.rowChart("#cccm .orgap",groupname)
.dimension(types)
.group(typesGroup)
.elasticX(true)
.width(350)
.height(200)
.renderLabel(true)
.renderTitle(true)
.colors(['#2a87cf'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(5); // .ordering(function (p) { return -p.value;});
*/
var governorates = xf.dimension(function(d) { return d.governorate; });
var governoratesByIndividual = governorates.group().reduceSum(function (d) { return d.individual; });
dc.rowChart("#cccm .governoratep",groupname)
.dimension(governorates)
.group(governoratesByIndividual)
.width(190)
.height(150)
.elasticX(true)
.renderLabel(true)
.ordering(function (p) { return -p.value;})
.colors(['#2a87cf'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
var districts = xf.dimension(function(d) { return d.district; });
var districtsByIndividual = districts.group().reduceSum(function (d) { return d.individual; });
dc.rowChart("#cccm .districtp",groupname)
.dimension(districts)
.group(districtsByIndividual)
.width(190)
.height(340)
.renderLabel(true)
.ordering(function (p) { return -p.value;})
.colors(['#2a87cf'])
.elasticX(true)
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
// it doesn't really matter what you index the dimension on,
// because you won't be able to filter on this dimension
// we just need something to call .groupAll on.
//Improvised_Shelter Tent Individual_mud_building Individual_mix_building Individual_concrete_building
// Shop Apartment_block Under_construction
// var accoms = xf.dimension(function(r) { return r.Improvised_Shelter; });
// var accomsGroup = regroup(accoms, ['Improvised_Shelter', 'Tent', 'Individual_mud_building', 'Individual_mix_building', 'Individual_concrete_building', 'Shop', 'Apartment_block Under_construction']);
var scores = xf.dimension(function(d) { return d.cluster; });
var scoresGroup = scores.group().reduceSum(function (d) { return d.individual;});
dc.rowChart("#cccm .scorep",groupname)
.dimension(scores)
.group(scoresGroup)
.width(250)
.height(445)
.renderLabel(true)
.renderTitle(true)
.colors(['#2a87cf'])
.colorDomain([0,0])
.elasticX(true)
.ordering(function (p) { return -p.value;})
.colorAccessor(function(d, i){return 1;})
//.ordering(function (p) { return -p.value;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
/*
var camps = xf.dimension(function(d) { return d.camp_name; });
var campsGroup = camps.group().reduceSum(function (d) { return d.individual;});
var filteredcampsGroup = remove_empty_bins(campsGroup);
dc.barChart("#cccm .camps",groupname)
.dimension(camps)
.group(campsGroup)
.width(1200)
.height(205)
.x(d3.scale.ordinal(campsGroup))
.xUnits(dc.units.ordinal)
.y(d3.scale.linear().domain([0, 10000]))
.brushOn(false)
.renderLabel(true)
.renderTitle(true)
.colors(['#2a87cf'])
.colorDomain([0,0])
.elasticY(true)
.elasticX(true)
//.ordering(function (p) { return -p.value;})
.colorAccessor(function(d, i){return 1;})
// .ordering(function (p) { return -p.value;})
.yAxis().ticks(4).tickFormat(d3.format("s"));
*/
/* there are way too many camps to include
dc.pieChart("#cccm .fightingp",groupname)
.dimension(fightings)
.group(fightingsGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(colorScale)
.colorDomain([0,4]);
var clusters = xf.dimension(function(d) { return d.cluster; });
var clustersGroup = accoms.group().reduceCount(function (d) { return d.cluster; });
dc.rowChart("#cccm .accomp",groupname)
.dimension(clusters)
.group(clustersGroup)
.width(220)
.height(205)
.renderLabel(true)
.renderTitle(true)
.colors(['#3182bd'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
//.ordering(function (p) { return -p.value;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
*/
var householdnums = xf.dimension(function(d) { return d.householdnum; });
var householdnumsGroup = householdnums.group().reduceCount();
dc.pieChart("#cccm .householdnump",groupname)
.dimension(householdnums)
.group(householdnumsGroup)
.width(115)
.height(115)
.height(115)
.renderLabel(true)
// .ordering(function (p) { return -p.value; })
.renderTitle(true);
//"opensite","abandonned","unfinished",
var unfinisheds = xf.dimension(function(d) { return d.unfinished; });
var unfinishedsGroup = unfinisheds.group().reduceCount();
dc.pieChart("#cccm .unfinishedp",groupname)
.dimension(unfinisheds)
.group(unfinishedsGroup)
.width(95)
.height(95)
.colors(['#D9FAEF', /* no */
'#F5C34E']) /* yes */
.renderLabel(true)
// .ordering(function (p) { return -p.value; })
.renderTitle(true);
var opensites = xf.dimension(function(d) { return d.opensite; });
var opensitesGroup = opensites.group().reduceCount();
dc.pieChart("#cccm .opensitep",groupname)
.dimension(opensites)
.group(opensitesGroup)
.width(95)
.height(95)
.colors(['#D9FAEF', /* no */
'#F5C34E']) /* yes */
.renderLabel(true)
// .ordering(function (p) { return -p.value; })
.renderTitle(true);
var abandonneds = xf.dimension(function(d) { return d.abandonned; });
var abandonnedsGroup = abandonneds.group().reduceCount();
dc.pieChart("#cccm .abandonnedp",groupname)
.dimension(abandonneds)
.group(abandonnedsGroup)
.width(95)
.height(95)
.colors(['#D9FAEF', /* no */
'#F5C34E']) /* yes */
.renderLabel(true)
.renderTitle(true)
.ordering(function (p) { return -p.value; });
// Table
/*
dc.dataTable("#dc-table-graph",groupname)
.width(960).height(800)
.dimension(governorates)
.group(function(d) { return "Sites Table" })
.size(30)
.columns([
function(d) { return d.governorate; },
function(d) { return d.district; },
function(d) { return d.household; },
function(d) { return d.individual; }
])
.sortBy(function(d){ return d.governorate; })
.order(d3.ascending)
.renderlet(function (table) { table.selectAll(".dc-table-group").classed("info", true); });
*/
$('#reset').on('click', function (){
dc.filterAll(groupname);
dc.redrawAll(groupname);
return false;
})
// dc.renderAll();
dc.renderAll(groupname);
}
</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<script src="js/bootstrap.js"></script>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
</script>
<div class="d3-tip n" style="position: absolute; display: none; box-sizing: border-box; top: 186.9px; left: 727.5px;"></div><div class="d3-tip" style="position: absolute; display: none; box-sizing: border-box;"></div>
</body>
</html>