This repository has been archived by the owner on Jul 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulation-age_pie.html
122 lines (113 loc) · 4.23 KB
/
population-age_pie.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
<!DOCTYPE html>
<html lang="de">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.bundle.min.js"></script>
<link href="css/style.css" rel="stylesheet">
<link href="css/charts.css" rel="stylesheet">
</head>
<body>
<div class="outer">
<div class="middle">
<div class="container">
<div class="row">
<div class="col-xs-0 col-sm-1 col-md-1 col-lg-1"></div>
<div class="col-xs-12 col-sm-10 col-md-10 col-lg-10 content">
<!-- caption -->
<h1>Bevölkerung nach Alter (2014)</h1>
<div class="panel">
<!-- canvas where the chart will be placed -->
<div style="width: 100%">
<canvas id="canvas"></canvas>
</div>
</div>
<!-- information about the source of the data -->
<p>
Quelle: Statistisches Landesamt Baden-Württemberg
</p>
</div>
<div class="col-xs-0 col-sm-1 col-md-1 col-lg-1"></div>
</div>
</div>
</div>
</div>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
};
var randomColorFactor = function() {
return Math.round(Math.random() * 255);
};
var randomColor = function(opacity) {
return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')';
};
var config = {
type: 'pie',
data: {
datasets: [{
data: [
1342,
1124,
1086,
995,
1150,
1594,
1643,
1400,
1318,
1075,
1335,
1380,
1108,
918,
865,
451,
529,
304
],
backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C",
"#949FB1",
"#4D5360",
],
}],
labels: [
"0-5",
"6-10",
"11-15",
"16-20",
"21-25",
"26-30",
"31-35",
"36-40",
"41-45",
"46-50",
"51-55",
"56-60",
"61-65",
"66-70",
"71-75",
"76-80",
"81-85",
">85"
]
},
options: {
responsive: true
}
};
window.onload = function() {
var ctx = document.getElementById("canvas").getContext("2d");
window.myPie = new Chart(ctx, config);
};
</script>
</body>
</html>