forked from yurukov/dc.leaflet.js
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
810 lines (671 loc) · 31.3 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
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
<!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="Edouard Legoupil">
<title>Site Assessment - CCCM Cluster Iraq</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/vnd.microsoft.icon" />
<meta itemprop="name" content="Site Assessment - CCCM Cluster Iraq"/>
<meta itemprop="description" content="Site Assessment - CCCM Cluster Iraq"/>
<meta property="og:title" content="Site Assessment - CCCM Cluster Iraq">
<meta property="og:type" content="article">
<meta property="og:url" content="http://unhcr-iraq.github.io/Site-Assessment/">
<meta property="og:image" content="http://unhcr-iraq.github.io/Site-Assessment/SiteAssessment.jpg">
<meta property="og:site_name" content="Site Assessment - CCCM Cluster Iraq">
<meta property="og:description" content="Site Assessment - CCCM Cluster Iraq">
<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/operations/iraq/camp-coordination-management" target="_blank">
<img src="images/ccccm-siteasessment2.png" style="width: 100%"></a>
</div>
<div class="col-xs-12">Explore the initial profile of the informal settlements hosting IDPs. 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>
<br>Data period: Novembre - December 2014 / Data released on: January 2015</div>
<div class="col-xs-10">Phase 1 recorded 880 informal settlements. 187 informal settlements were inactives from Phase 1. In addition Phase 2 recorded 42 new informal sites</div>
<div class="socialmedia" data-step="9" data-intro="Share this visualisation on twitter!" data-position="left">
<table>
<tbody><tr>
<td valign="middle"><a href="https://twitter.com/intent/tweet?url=http://unhcr-iraq.github.io/Site-Assessment/&text=%23Assessment%23IDP%23Iraq%23CCCM%20@UNHCRIraq%20@IOMIraq%20@REACH_info%20@edouard_lgp" target="_blank"><img src="images/Twitter.png" style="height: 25px; width: 25px"></a></td>
</tr>
</tbody></table>
</div>
<div class="row" >
<div class="col-md-2">
<a class="btn btn btn-success" href="javascript:void(0);" onclick="javascript:introJs().start();">How-To</a>
</div>
<div class="col-md-9" data-step="1" data-intro="This displays the number of sites you filtered. Use the reset button to delete all your filters" data-position="right">
<div id="count-info" class="col-md-8">
<p></p><strong><span class="filter-count"></span></strong> sites selected out of <strong><span class="total-count"></span></strong> records. <span id="totalind" class="number-display"></span> individuals.
<span id="totalhou" class="number-display"></span> household, <span id="totalmen" class="number-display"></span> men, <span id="totalwom" class="number-display"></span> women, <span id="totalboy" class="number-display"></span> boys, <span id="totalgirl" class="number-display"></span> girls.
</p>
</div>
<div class="col-md-1">
<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 chart below to filter the sites per condition type" data-position="left">
<h4>Filter on conditions within the sites</h4>
<p><small><i>Based on site observations by enumerators</i></small></p>
<div class="col-md-2" >
<div class="openelementp" id="cccm" class="dc-chart" >
<p><small>Open to the elements</small></p>
</div>
</div>
<div class="col-md-2" >
<div class="waterp" id="cccm" class="dc-chart" >
<p><small>Limited access to water</small></p>
</div>
</div>
<div class="col-md-2" >
<div class="waterqp" id="cccm" class="dc-chart" >
<p><small>Poor quality drinking water</small></p>
</div>
</div>
<div class="col-md-2" >
<div class="hazardsp" id="cccm" class="dc-chart" >
<p><small>Falling hazards</small></p>
</div>
</div>
<div class="col-md-2" >
<div class="electricp" id="cccm" class="dc-chart" >
<p><small>Limited access to electricity</small></p>
</div>
</div>
<div class="col-md-2" >
<div class="minesp" id="cccm" class="dc-chart" >
<p><small>Risk of unexploded mines</small></p>
</div>
</div>
</div>
<div class="row" ></div>
<div class="row" id="cccm">
<div class="col-md-2">
<div class="governoratep" class="col-xs-6 dc-chart" data-step="3" data-intro="Click on this bar chart to filter by governorate" data-position="right">
<h4>Governorates</h4>
<p><small><i>Number of individuals</i></small></p>
</div>
<div class="classp" class="col-xs-6 dc-chart" data-step="4" data-intro="Click on this bar chart to filter by site class size" data-position="right">
<h4>Site size</h4>
<p><small><i>Number of sites by size</i></small></p>
</div>
</div>
<div class="col-md-4" data-step="5" data-intro="Click on this bar chart to filter by district" data-position="right">
<div class="districtp" class="dc-chart" >
<h4>Districts</h4>
<p><small><i>Number of individuals</i></small></p>
</div>
</div>
<div class="col-md-2" data-step="6" data-intro="Click on these chart to filter by site environment or shelter composition" data-position="right">
<div class="environmentp" id="cccm" class="dc-chart" >
<h4>Site type</h4>
<p><small><i>Direct environment</i></small></p>
</div>
<div class="scorep" id="cccm" class="dc-chart">
<h4>Composite Score</h4>
<p><small><i><a href="https://github.com/unhcr-iraq/cccm-assessment/blob/master/data.R" target="_blank">
(water_access + water_quality + openelement + damage + mines+ hazards + fighting) ranked in 5 five classes.</a><br >Number of sites</i></small></p>
</div>
<!--
-->
</div>
<div class="col-md-4" data-step="7" data-intro="Click on the map to filter by site" data-position="left">
<h4>Map: Location of the sites</h4>
<p><small><i>Zoom on the map to filter sites. click on the pinpoint for more information</i></small></p>
<div class="map" id="cccm" > </div>
</div>
</div>
<div class="row" ></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>
<small><a href="https://github.com/unhcr-iraq/Site-Assessment" target="_blank">Credit</a></small>
<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.tsv("data/dataviz.tsv", 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;
*/
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)
.group(all);
*/
var facilities = xf.dimension(function(d) { return d.geo; });
var facilitiesGroup = facilities.group().reduceCount();
dc.leafletMarkerChart("#cccm .map",groupname)
.dimension(facilities)
.group(facilitiesGroup)
.width(400)
.height(390)
.center([34.7503,44.5385])
.zoom(6)
.cluster(true)
.filterByArea(true)
// .featureKeyAccessor(function(feature) {return feature.properties.geo; })
.renderPopup(true)
// .popup(function(feature) { return feature.properties.sitear+" : "+feature.properties.neighbourhood; });
//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 waters = xf.dimension(function(d) { return d.water_access; });
var watersGroup = waters.group().reduceCount();
dc.pieChart("#cccm .waterp",groupname)
.dimension(waters)
.group(watersGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
var waterqs = xf.dimension(function(d) { return d.water_quality; });
var waterqsGroup = waterqs.group().reduceCount();
dc.pieChart("#cccm .waterqp",groupname)
.dimension(waterqs)
.group(waterqsGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
var electrics = xf.dimension(function(d) { return d.electric; });
var electricsGroup = electrics.group().reduceCount();
dc.pieChart("#cccm .electricp",groupname)
.dimension(electrics)
.group(electricsGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
var openelements = xf.dimension(function(d) { return d.openelement; });
var openelementsGroup = openelements.group().reduceCount();
dc.pieChart("#cccm .openelementp",groupname)
.dimension(openelements)
.group(openelementsGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
var damages = xf.dimension(function(d) { return d.damage; });
var damagesGroup = damages.group().reduceCount();
dc.pieChart("#cccm .damagep",groupname)
.dimension(damages)
.group(damagesGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
var hazardss = xf.dimension(function(d) { return d.hazards; });
var hazardssGroup = hazardss.group().reduceCount();
dc.pieChart("#cccm .hazardsp",groupname)
.dimension(hazardss)
.group(hazardssGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
var miness = xf.dimension(function(d) { return d.mines; });
var minessGroup = miness.group().reduceCount();
dc.pieChart("#cccm .minesp",groupname)
.dimension(miness)
.group(minessGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .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(true)
.renderTitle(true)
.colors(['#cb181d', /* maj */
'#fb6a4a', /* mod */
'#fcae91', /* min */
'#fee5d9' /* no */
])
.colorDomain([0,4]);
// .ordering(function (p) { return -p.value; });
var environments = xf.dimension(function(d) { return d.environment; });
var environmentsGroup = environments.group().reduceCount();
dc.pieChart("#cccm .environmentp",groupname)
.dimension(environments)
.group(environmentsGroup)
.width(95)
.height(95)
.renderLabel(true)
.renderTitle(true)
.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(200)
.renderLabel(true)
.renderTitle(true)
.colors(['#3182bd'])
.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.organisat; });
var typesGroup = types.group().reduceCount();
dc.rowChart("#cccm .orgap",groupname)
.dimension(types)
.group(typesGroup)
.width(350)
.height(200)
.renderLabel(true)
.renderTitle(true)
.colors(['#3182bd'])
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
// .ordering(function (p) { return -p.value;});
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(350)
.height(400)
.renderLabel(true)
.ordering(function (p) { return -p.value;})
.colors(['#3182bd'])
.elasticX(true)
.colorDomain([0,0])
.colorAccessor(function(d, i){return 1;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
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(200)
.height(150)
.elasticX(true)
.renderLabel(true)
.ordering(function (p) { return -p.value;})
.colors(['#3182bd'])
.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.scoreclass; });
var scoresGroup = scores.group().reduceCount(function (d) { return d.scoreclass; });
dc.rowChart("#cccm .scorep",groupname)
.dimension(scores)
.group(scoresGroup)
.width(220)
.height(185)
.renderLabel(true)
.renderTitle(true)
.colors(['#3182bd'])
.colorDomain([0,0])
.elasticX(true)
.colorAccessor(function(d, i){return 1;})
//.ordering(function (p) { return -p.value;})
.xAxis().ticks(4).tickFormat(d3.format("s"));
/*
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>
<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-55906613-1', 'auto');
ga('send', 'pageview');
</script>
</html>