-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
719 lines (594 loc) · 23.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
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://moj-analytical-services.github.io/criminal_justice_statistics_sankey/javascript/asdConsoleOutput.js"></script>
<script src="https://moj-analytical-services.github.io/criminal_justice_statistics_sankey/javascript/sankey.js"></script>
<title> Criminal History Sankey Diagram</title>
<style>
html
{
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
}
body{
width: 100%;
margin: 0 auto;
}
button {
clear: right;
}
label {
font-weight: normal;
}
h1 {
font-size: 30px;
}
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
.node text {
pointer-events: none;
text-shadow: 0 1px 0 #fff;
}
.link {
fill: none;
stroke: #fff;
stroke-opacity: .2;
}
.link:hover {
stroke-opacity: .5;
}
#chart {
width: 80%;
display: inline;
float: left;
}
.control { float: ; padding: 6px; font-size:14px; }
.control label {
display: block;
}
.control button { border: outset 2px; }
.control button.active { border: inset 2px; }
#filterOptions {
width: 20%;
height: 100%;
float: left;
min-width: 150px;
font-size: 75%;
}
.svg-container {
display: inline-block;
/* float: left;*/
position: relative;
width: 80%;
padding-bottom: 100%; /* aspect ratio */
vertical-align: top;
left: 10px;
overflow: hidden;
min-width: 600px;
}
.svg-content-responsive {
display: inline-block;
position: absolute;
top: 10px;
left: 0px;
min-width: 600px;
}
#header{
width: 100%;
min-width: 600px;
height: 120px;
}
#moj_logo {
width:120px;
height:120px;
position: absolute;
}
#head1{
left: 140px;
position: absolute;
min-width: 400px;
}
#logo{
float: left;
width:120px;
height:120px;
}
.clear{
clear: both;
}
</style>
<body>
<div id = "header">
<div id = "logo">
<img src="https://moj-analytical-services.github.io/criminal_justice_statistics_sankey/data/moj_logo.png" id = "moj_logo">
</div>
<div id = "head1">
<h1>Criminal Justice System and Offenders Criminal History</h1>
<div id = "button_div">
<button id = "caveat_button" type="button" class="btn btn-info" data-toggle="collapse" data-target="#caveats">Hide explanation</button>
<button id = "filter_options_button" type="button" class="btn btn-info" data-toggle="collapse" data-target="#filterOptions">Hide filter options</button>
</div>
</div>
</div>
<div class="clear"></div>
<div id="caveats" class="collapse">
<h3> Explanatory notes </h3>
<ol>
<li>Every effort is made to ensure that the figures presented are accurate and complete. However, it is important to note that these data have been extracted from the Police National Computer (PNC). The PNC is a large administrative data system as well as a live operational database. Therefore, care should be taken to ensure data collection processes and their inevitable limitations are considered when those data are used. </li>
<Li>Figures shown in the graph are counts of caution or conviction occasions for offences dealt with by the Home Office police force and British Transport police and prosecuted in English and Welsh court. Offence type is based on the primary offence on the occasion. Where multiple offences were on the same occasion, the primary was one received the heaviest penalty.</Li>
<li>Figures include males, females, persons where sex "Not Stated" and other offenders, i.e. companies, public bodies, etc. </li>
<li> Dropdown Options and tick boxes allow different combinations to be shown. For more information on offenders criminal history and commentary on the statistics underlying this tool please visit the <a href = https://www.gov.uk/government/statistics/first-time-entrants-fte-into-the-criminal-justice-system-and-offender-histories-year-ending-december-2023> publication landing page</a>. </li>
<li> The default view of the chart may not be ordered as required by users. However, it can be rearranged by drag the notes to the position as wanted.</Li>
</ol>
</div>
<div id = "filterOptions">
<div class="control">
<label for ="year"><b>Select 12 months ending December:</b></label>
<select id = "year">
<option>2023</option>
<option>2022</option>
<option>2021</option>
<option>2020</option>
<option>2019</option>
<option>2018</option>
<option>2017</option>
<option>2016</option>
<option>2015</option>
<option>2014</option>
<option>2013</option>
</select>
</div>
<!--checkbox age grouo -->
<div class="control" id="otype_control">
<label for ="otype_control"><b>Select age group</b></label>
<label><input type="checkbox" checked class="select_all" id = "select_all_type" value="type" checked> <i>Select All</i></label>
<label><input type="checkbox" checked class="otype" value="Adults" checked> Adults</label>
<label><input type="checkbox" checked class="otype" value="Juveniles" checked> Juveniles</label>
<!-- <label><input type="checkbox" checked class="otype" value="Unknown" checked> Unknown</label> -->
</div>
<!--checkbox gender group -->
<div class="control" id="gender_control">
<label for ="ogender_control"><b>Select gender group</b></label>
<label><input type="checkbox" checked class="select_all" id = "select_all_gender" value="sex" checked> <i>Select All</i></label>
<label><input type="checkbox" checked class="ogender" value="1 Male" checked> Males</label>
<label><input type="checkbox" checked class="ogender" value="2 Female" checked> Females</label>
<label><input type="checkbox" checked class="ogender" value="3 Unknown" checked> Unknown</label>
</div>
<!-- checkbox offence type -->
<div class="control" id="ogroup_control">
<label for ="ogroup_control"><b>Select offence group</b></label>
<label><input type="checkbox" checked
class="select_all" id = "select_all_group"
value="group"> <i>Select All</i> </label>
<label><input type="checkbox" checked
class="ogroup"
value="01 Violence against the person"> Violence against the person</label>
<label><input type="checkbox" checked
class="ogroup"
value="02 Sexual offences"> Sexual offences</label>
<label><input type="checkbox" checked
class="ogroup"
value="03 Robbery"> Robbery</label>
<label><input type="checkbox" checked
class="ogroup"
value="04 Theft Offences"> Theft offences</label>
<label><input type="checkbox" checked
class="ogroup"
value="05 Criminal damage and arson"> Criminal damage and arson</label>
<label><input type="checkbox" checked
class="ogroup"
value="06 Drug offences"> Drug offences</label>
<label><input type="checkbox" checked
class="ogroup"
value="07 Possession of weapons"> Possession of weapons</label>
<label><input type="checkbox" checked
class="ogroup"
value="08 Public order offences"> Public order offences</label>
<label><input type="checkbox" checked
class="ogroup"
value="09 Miscellaneous crimes against society"> Miscellaneous crimes against society</label>
<label><input type="checkbox" checked
class="ogroup"
value="10 Fraud offences"> Fraud offences</label>
<label><input type="checkbox" checked
class="ogroup"
value="11 Summary offences excluding motoring"> Summary non-motoring</label>
<label><input type="checkbox" checked
class="ogroup"
value="12 Summary motoring offences"> Summary motoring</label>
</div>
</div>
<div id = "chartId"></div>
<script>
var originalData = [];
// Wrap data read in a promise to ensure data is read in before being referenced later on
var dataRead = new Promise(function(resolve, reject){
d3.csv("data/Sankey_data_2023.csv", function(error, data) {
if(error) reject(error);
data.forEach(function (d){
originalData.push(
{
"orderID": d.orderid,
"year": d.year,
"offence_type": d.offence_type,
"offence_group": d.offence_group,
"gender": d.gender,
"source": d.source,
"target": d.target,
"value": +d.value
})
});
resolve();
});
});
function initialise_data(){
var graph = {"nodes" : [], "links" : []};
updateData();
}
// Initialise tickbox selections
d3.selectAll(".ogroup").property("checked",true);
d3.selectAll(".otype").property("checked",true);
d3.selectAll(".ogender").property("checked",true);
d3.selectAll(".select_all").property("checked", true);
// Call update data on tickbox change
d3.selectAll(".ogroup").on("change", checkboxEvent);
d3.selectAll(".otype").on("change", checkboxEvent);
d3.selectAll(".ogender").on("change", checkboxEvent);
d3.selectAll("#year").on("change", updateData);
d3.selectAll(".select_all").on("change", selectAllUpdate);
// Add button name default and change on click function
d3.select("#caveats").attr("class","collapse in")
d3.select("#caveat_button").on("click", function(){
if(d3.select("#caveats")[0][0].className == "collapse"){
d3.select("#caveat_button")[0][0].textContent = "Hide caveats"
}
else{
d3.select("#caveat_button")[0][0].textContent = "Show caveats"
}
})
// Add button name change for filerOptions
d3.select("#filterOptions").attr("class","collapse in")
d3.select("#filter_options_button").on("click", function(){
if(d3.select("#filterOptions")[0][0].className == "collapse"){
d3.select("#filter_options_button")[0][0].textContent = "Hide options"
}
else{
d3.select("#filter_options_button")[0][0].textContent = "Show options"
}
})
var units = "Convictions/Cautions";
var margin = {top: 10, right: 10, bottom: 5, left: 10},
width = 1200 - margin.left - margin.right,
height = 800 - margin.top - margin.bottom;
var formatNumber = d3.format(",.0f"), // zero decimal places
format = function(d) { return formatNumber(d) + " " + units; },
color = d3.scale.category20b();
var svg = d3.select("div#chartId")
.append("div")
.classed("svg-container", true) //container class to make it responsive
.append("svg")
//responsive SVG needs these 2 attributes and no width and height attr
.attr("preserveAspectRatio", "xMidYMid meet")
.attr("viewBox", "0 0 1200 800")
// .attr("viewBox", "0 0 1200 700")
//class to make it responsive
.classed("svg-content-responsive", true);
// Set the sankey diagram properties
var sankey = d3.sankey()
.nodeWidth(40)
.nodePadding(50)
.size([width, height]);
var path = sankey.link();
// colour Scheme
function colores_google(n) {
var colores_g = ["#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00", "#b82e2e", "#316395", "#994499", "#22aa99", "#aaaa11", "#6633cc", "#e67300", "#8b0707", "#651067", "#329262", "#5574a6", "#3b3eac"];
return colores_g[n % colores_g.length];
}
allNodes = [];
nodeMap = [];
dataRead.then(function(e){
originalData.forEach(function (d) {
allNodes.push({ "name": d.source });
allNodes.push({ "name": d.target });
});
// Iterate through a unique list of allNode names and attach a colour to each name
d3.keys(d3.nest().key(function (d) { return d.name; }).map(allNodes)).forEach(function (d,i) {
nodeMap[d] = colores_google(i);
});
initialise_data();
});
function updateData(){
var offenceTypes = [];
var offenceGroups = [];
var genderTypes = [];
var graph = {"nodes" : [], "links" : []};
// Populate list of offence types from selector
for (i = 0; i < d3.selectAll(".otype")[0].length; i++){
if(d3.selectAll(".otype")[0][i].checked){
offenceTypes.push(d3.selectAll(".otype")[0][i].value);
}
}
// Populate list of offence groups from selector
for (i = 0; i < d3.selectAll(".ogroup")[0].length; i++){
if(d3.selectAll(".ogroup")[0][i].checked){
offenceGroups.push(d3.selectAll(".ogroup")[0][i].value);
}
}
// Populate list of gender types from selector
for (i = 0; i < d3.selectAll(".ogender")[0].length; i++){
if(d3.selectAll(".ogender")[0][i].checked){
genderTypes.push(d3.selectAll(".ogender")[0][i].value);
}
}
// filter data based on selections
var filteredData = originalData.filter(function(d){
return offenceGroups.indexOf(d.offence_group) >= 0 & offenceTypes.indexOf(d.offence_type) >= 0 & genderTypes.indexOf(d.gender) >= 0 & d.year == d3.select("#year").node().value;
});
// TEMP FIX
// var filteredData = originalData;
var sourceTargetNest = d3.nest()
.key(function(d) {return d.source})
.key(function(d) {return d.target})
.rollup(function(v) {return d3.sum(v, function(v2){return v2.value;})})
.entries(filteredData);
filteredData.forEach(function (d) {
graph.nodes.push({ "name": d.source });
graph.nodes.push({ "name": d.target });
});
for(i=0; i<sourceTargetNest.length; i++) {
for(j=0; j < sourceTargetNest[i].values.length; j++){
graph.links.push({"source": sourceTargetNest[i].key, "target":sourceTargetNest[i].values[j].key, "value": sourceTargetNest[i].values[j].values});
}
}
//thanks Mike Bostock https://groups.google.com/d/msg/d3-js/pl297cFtIQk/Eso4q_eBu1IJ
//this handy little function returns only the distinct / unique nodes
graph.nodes = d3.keys(d3.nest().key(function (d) { return d.name; }).map(graph.nodes));
//it appears d3 with force layout wants a numeric source and target
//so loop through each link replacing the text with its index from node
graph.links.forEach(function (d, i) {
graph.links[i].source = graph.nodes.indexOf(graph.links[i].source);
graph.links[i].target = graph.nodes.indexOf(graph.links[i].target);
});
//now loop through each nodes to make nodes an array of objects rather than an array of strings
graph.nodes.forEach(function (d, i) {
graph.nodes[i] = {
"name": d,
"colour": nodeMap[d]
};
});
updateSankey(graph);
}
function updateSankey(graph){
sankey
.nodes(graph.nodes)
.links(graph.links)
// .layout(80); //Original
.layout(0) //Yu changed
link = svg.selectAll(".link")
// key function allows data to be mapped to the same elements as previous data of same source and target names
.data(graph.links, function(d) {
return d.source.name + d.target.name;
});
// CREATE LINK ELEMENTS FOR DATA NOT YET BOUND TO ANY ELEMENTS
link.enter().append("path")
.attr("class", "link")
.attr("d", path)
.sort(function(a, b) { return b.dy - a.dy; })
.append("title")
.text(function(d) {
return d.source.name + " → " +
d.target.name + "\n" + format(d.value); });
// UPDATE THE EXISTING LINK ELEMENTS //
link
.transition()
.duration(1000)
.attr("class", "link")
.attr("d", path)
.style("stroke-width", function(d) { return Math.max(1, d.dy); });
// update text elements
svg.selectAll(".link>title")
.data(graph.links, function(d) {
return d.source.name + d.target.name;
})
.transition()
.text(function(d) {
return d.source.name + " → " +
d.target.name + "\n" + format(d.value);
});
//DELETE LINK ELEMENTS THAT NO LONGER HAVE DATA BOUND TO THEM
link.exit().remove();
// JOIN NEW DATA TO NODE
node = svg.selectAll(".node")
.data(graph.nodes, function(d) {return d.name;});
// CREATE NODE ELEMENTS FOR DATA NOT YET BOUND TO ANY ELEMENTS
var node_g = node.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
})
.call(d3.behavior.drag()
.origin(function(d) { return d; })
.on("dragstart", function() {
this.parentNode.appendChild(this); })
.on("drag", dragmove));
node_g.append("rect")
.attr("height", function(d) { return d.dy; })
.attr("width", sankey.nodeWidth())
.style("fill", function(d) {
return d.colour })
.style("stroke", function(d) {
return d3.rgb(d.color).darker(2); })
.append("title")
.text(function(d) {
return d.name + "\n" + format(d.value); })
node_g.append("text")
.attr("x", -6)
.attr("y", function(d) { return d.dy / 2; })
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function(d) { return d.name; })
.filter(function(d) { return d.x < width / 2; })
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
// UPDATE EXISTING NODE ELEMENTS (with transistions)
node
.transition()
.duration(1000)
.attr("class", "node")
.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
// UPDATE EXISTING RECTANGLES
svg.selectAll(".node>rect").data(graph.nodes, function(d) {return d.name;})
.transition()
.duration(1000)
.style("fill", function(d) {
return d.colour })
.attr("height", function(d) {
return d.dy;
});
//UPDATE EXISTING TITLES
svg.selectAll(".node>rect>title")
.data(graph.nodes, function(d) {return d.name;})
.transition()
.duration(1000)
.text(function(d) {
return d.name + "\n" + format(d.value);
});
svg.selectAll(".node>text")
.data(graph.nodes, function(d) {return d.name;})
.transition()
.duration(1000)
.attr("x", -6)
.attr("y", function(d) {
return d.dy / 2;
})
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function(d) {
return d.name;
})
.filter(function(d) {
return d.x < width / 2;
})
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
// REMOVE NODE ELEMENTS THAT ARE NO LONGER BOUND TO DATA
node.exit().remove();
// Convert all colours of links to match nodes
svg.selectAll(".link")
.style('stroke', function(d){
return d.source.colour;
})
// the function for moving the nodes
function dragmove(d) {
d3.select(this).attr("transform",
"translate(" + d.x + "," + (
d.y = Math.max(0, Math.min(height - d.dy, d3.event.y))
) + ")");
sankey.relayout();
link.attr("d", path);
}
}
function checkSelectAll(){
// select all otype elements, return their checked value as an array and then use javascript fn "every"
//to see if all on. If all tickboxes are on then set "select all" tickbox to true otherwise set it to false.
//Do this for both offence type and group select all buttons. Then update sankey.
var allCheck = {"type": false, "group": false, "sex": false};
allCheck.type = d3.selectAll(".otype")[0].map(function(d){return d.checked}).every(function(d){ return d});
allCheck.group = d3.selectAll(".ogroup")[0].map(function(d){return d.checked}).every(function(d){ return d});
allCheck.sex = d3.selectAll(".ogender")[0].map(function(d){return d.checked}).every(function(d){ return d});
d3.select("#select_all_type").property("checked", allCheck.type);
d3.select("#select_all_gender").property("checked", allCheck.sex);
d3.select("#select_all_group").property("checked", allCheck.group);
}
function selectAllUpdate(){
// if select all is turned on then set all options to checked and update sankey
d3.selectAll(".ogroup,.otype,.ogender,.select_all").property("checked",this.checked)
d3.selectAll(".select_all").property("checked")
//if selectAll button has been turned off
if(this.checked == false){
// select all tick boxes and turn them off
d3.selectAll(".ogroup,.otype,.ogender,.select_all").property("checked",false);
}
else{
// if every offence type and group tick box is off
if(d3.selectAll(".otype,.ogroup,ogender")[0].map(function(d){return d.checked}).every(function(d) {return d == false})){
// then select everything on
d3.selectAll(".otype,.ogroup,ogender,.select_all").property("checked",true);
}
}
//Yu added below are not needed for Criminal history statisitcs
// If select all types has been clicked on and all indictable offence groups are off
// if(this.value == "type" && this.checked && d3.selectAll(".ogroup.ind_linked")[0].map(function(d){return d.checked}).every(function(d) {return d == false})){
// d3.selectAll(".ogroup.ind_linked").property("checked", true);
// }
// If select all groups has been clicked
// else if(this.value == "group" && this.checked && d3.selectAll(".otype.ind_linked")[0].map(function(d){return d.checked}).every(function(d) {return d == false})){
// d3.selectAll(".otype.ind_linked").property("checked", true);
// }
// Select all tick boxes for whichever select all category was pressed
d3.selectAll(".o"+this.value).property("checked",this.checked);
// match summary offence clicks to select all as summary tickboxes are linked
//d3.selectAll(".SNM, .SMO").property("checked",this.checked);
checkSelectAll();
updateData();
}
function checkboxEvent(){
// update the select all checkbox based on other checkboxes state and update sankey
if (-1<["snm", "smo", "summary motoring", "summary non-motoring"].indexOf(this.value)){
d3.selectAll("."+this.className.substring(this.className.length-3,this.className.length)).property("checked",this.checked);
}
// if both IND and TEW are off
if(d3.selectAll(".otype.ind_linked")[0].map(function(d){return d.checked}).every(function(d) {return d == false})){
// Check if the click event was from IND or TEW
if(this.value == "ind" || this.value == "tew" ){
d3.selectAll(".ogroup.ind_linked").property("checked", false);
}
// Check to see if the click event was from and indicable offence group if so and turned on turn on both ind and tew
if(-1 < d3.selectAll(".ogroup.ind_linked")[0].map(function(d){return d.value}).indexOf(this.value) && this.checked){
d3.selectAll(".otype.ind_linked").property("checked",true);
}
}
// if offence groups 1 - 10 are off
if(d3.selectAll(".ogroup.ind_linked")[0].map(function(d){return d.checked}).every(function(d) {return d == false})){
// Check if the click event was from IND or TEW
if((this.value == "ind" || this.value == "tew") && this.checked){
d3.selectAll(".ogroup.ind_linked").property("checked", true);
}
// Check to see if the click event was from an indicable offence group if so and turned off turn on both ind and tew
if(-1 < d3.selectAll(".ogroup.ind_linked")[0].map(function(d){return d.value}).indexOf(this.value) && !this.checked){
d3.selectAll(".otype.ind_linked").property("checked",false);
}
}
checkSelectAll();
updateData();
}
// Javascript for interface
function showOptions(){
if(document.getElementById("hideOptions").checked){
d3.select("#filterOptions").style("display","block");
}
else{
d3.select("#filterOptions").style("display","none");
}
}
</script>
<!-- Google Analytics -->
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-99085740-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>