forked from zzseba78/Kick-Off
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chartScripts.js
178 lines (167 loc) · 4.41 KB
/
chartScripts.js
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
// Chart 1
// ========================================================================
var char1El = document.getElementById('chart1');
new Chart(char1El, {
type: 'bar',
data: {
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
datasets: [{
label: "Population (millions)",
backgroundColor: ["#39f", "#895df6", "#3cba9f", "#e8c3b9", "#c45850"],
data: [1478, 5267, 3600, 1900, 4700]
}]
},
options: {
maintainAspectRatio: false,
responsiveAnimationDuration: 500,
legend: {
display: false
},
animation: {
duration: 2000
},
title: {
display: true,
text: 'Predicted world population (millions) in 2050'
}
}
});
// Chart 2
// ========================================================================
var char2El = document.getElementById('chart2');
new Chart(char2El, {
type: 'line',
data: {
labels: [2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018],
datasets: [{
data: [2004, 2000, 3200, 1200, 3450, 2300, 2200, 1200, 900, 1450],
label: "Africa",
borderColor: "#39f",
fill: false
}, {
data: [4500, 4800, 5200, 5000, 5200, 5500, 5900, 6500, 6800, 7200],
label: "Asia",
borderColor: "#895df6",
fill: false
}, {
data: [3400, 3200, 2800, 5600, 4500, 3200, 3400, 3800, 4800, 4200],
label: "Europe",
borderColor: "#3cba9f",
fill: false
}, {
data: [1200, 1100, 1250, 1200, 1300, 1450, 1300, 1200, 1320, 1350],
label: "Latin America",
borderColor: "#e8c3b9",
fill: false
}, {
data: [600, 3400, 2000, 1200, 7500, 2300, 3200, 6000, 3400, 4500],
label: "North America",
borderColor: "#c45850",
fill: false
}]
},
options: {
maintainAspectRatio: false,
responsiveAnimationDuration: 500,
animation: {
duration: 2000
},
title: {
display: true,
text: 'Sales per region'
}
}
});
// Chart 3
// ========================================================================
var char3El = document.getElementById('chart3');
new Chart(char3El, {
type: 'horizontalBar',
data: {
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
datasets: [{
label: "Population (millions)",
backgroundColor: ["#39f", "#895df6", "#3cba9f", "#e8c3b9", "#c45850"],
data: [900, 7000, 5700, 2800, 5600]
}]
},
options: {
maintainAspectRatio: false,
responsiveAnimationDuration: 500,
legend: {
display: false
},
animation: {
duration: 2000
},
title: {
display: true,
text: 'Predicted activity in 2020'
}
}
});
// Chart 4
// ========================================================================
var char4El = document.getElementById('chart4');
new Chart(char4El, {
type: 'radar',
data: {
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
datasets: [{
label: "1950",
fill: true,
backgroundColor: "rgba(51,153,255,0.6)",
borderColor: "rgba(51,153,255,0.2)",
pointBorderColor: "#fff",
pointBackgroundColor: "rgba(179,181,198,1)",
data: [8.77, 55.61, 21.69, 6.62, 6.82]
}, {
label: "2050",
fill: true,
backgroundColor: "rgba(255,99,132,0.2)",
borderColor: "rgba(255,99,132,1)",
pointBorderColor: "#fff",
pointBackgroundColor: "rgba(255,99,132,1)",
pointBorderColor: "#fff",
data: [25.48, 54.16, 7.61, 8.06, 4.45]
}]
},
options: {
maintainAspectRatio: false,
responsiveAnimationDuration: 500,
animation: {
duration: 2000
},
title: {
display: true,
text: 'Distribution in % of world population'
}
}
});
// Chart 4
// ========================================================================
var char5El = document.getElementById('chart5');
new Chart(char5El, {
type: 'doughnut',
data: {
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
datasets: [
{
label: "Population (millions)",
backgroundColor: ["#39f", "#895df6","#3cba9f","#e8c3b9","#c45850"],
data: [2478,5267,734,784,433]
}
]
},
options: {
maintainAspectRatio: false,
responsiveAnimationDuration: 500,
animation: {
duration: 2000
},
title: {
display: true,
text: 'Predicted world population (millions) in 2050'
}
}
});