-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelationchart.js
More file actions
147 lines (134 loc) · 4.28 KB
/
relationchart.js
File metadata and controls
147 lines (134 loc) · 4.28 KB
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
//build charts
$(document).ready(function(){
console.log("document ready");
makeChart();
makeChartTwo();
});
function makeChart(){
Highcharts.getOptions().plotOptions.pie.colors = (function () {
var colors = ['#2c7c7c', '#369999', '#c8e6e6', '#c8e6e6', '#c8e6e6', '#c8e6e6', '#c8e6e6', '#c8e6e6', '#c8e6e6', '#c8e6e6', '#c8e6e6'],
base = Highcharts.getOptions().colors[0],
i;
for (i = 0; i < 10; i += 1) {
// Start out with a darkened base color (negative brighten), and end
// up with a much brighter color
colors.push(Highcharts.Color(base).brighten((i - 3) / 7).get());
}
return colors;
}());
$('#container').highcharts({
chart: {
plotBackgroundColor: '#FCFCFC',
backgroundColor: '#fcfcfc',
plotBorderWidth: null,
plotShadow: false,
},
title: {
text: 'Who are the most common abusers?',
align: 'left',
x: -10,
style: {
fontSize: '17px',
fontWeight: 'bold',
fontFamily: 'Oswald',
color: '#444444'
}
},
tooltip: {
style: {
padding: 20,
fontSize: '14px'
},
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>',
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: false
}
},
series: [{
type: 'pie',
name: 'Percentage:',
data: [
['Parent', 80.3],
{
name: 'Other relative',
y: 6.1,
sliced: false,
selected: true
},
['Other', 4.6],
['Unmarried partner of parent', 4.2],
['Unknown', 3.1],
['Friend and neighbor', 0.4],
['Child care provider', 0.4],
['Foster parent', 0.3],
['Legal guardian', 0.2],
['Other professional', 0.1],
['Group home staff', 0.1]
]
}]
});
};
function makeChartTwo(){
$('#parentPerp').highcharts({
chart: {
plotBackgroundColor: '#FCFCFC',
backgroundColor: '#fcfcfc',
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'What Percentage of Victims are Victimized by Parent Perpetrators?',
align: 'left',
x: -10,
verticalAlign: 'top',
y: 25,
style: {
fontSize: '17px',
fontWeight: 'bold',
fontFamily: 'Oswald',
color: '#444444'
}
},
tooltip: {
style: {
padding: 20,
fontSize: '14px'
},
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
dataLabels: {
enabled: false,
distance: -60,
style: {
fontWeight: 'bold',
color: 'black'
}
},
startAngle: -90,
endAngle: 90,
center: ['50%', '65%']
}
},
series: [{
type: 'pie',
name: 'Victim percent',
innerSize: '50%',
data: [
['Mother', 45],
['Both parents', 24],
['Father', 23],
['Mother and other', 7],
['Father and other', 1]
]
}]
});
}