|
@@ -1,76 +1,76 @@
|
1
|
1
|
//円グラフのデータ
|
2
|
|
-var PopMan = 8862;
|
3
|
|
-var PopWoman = 9596;
|
4
|
|
-var data = [
|
5
|
|
- {
|
6
|
|
- value : PopMan,
|
7
|
|
- color : "#01a9de"
|
8
|
|
- },
|
9
|
|
- {
|
10
|
|
- value : PopWoman,
|
11
|
|
- color : "#eb5f60"
|
12
|
|
- }
|
|
2
|
+var PopMan = 8857;
|
|
3
|
+var PopWoman = 9608;
|
|
4
|
+var data = [{
|
|
5
|
+ value: PopMan,
|
|
6
|
+ color: "#01a9de"
|
|
7
|
+ },
|
|
8
|
+ {
|
|
9
|
+ value: PopWoman,
|
|
10
|
+ color: "#eb5f60"
|
|
11
|
+ }
|
13
|
12
|
];
|
14
|
13
|
var options = {
|
15
|
|
- //Boolean - Whether we should animate the chart
|
16
|
|
- animation : true,
|
17
|
|
-
|
18
|
|
- //Number - Amount of animation steps
|
19
|
|
- animationSteps : 100,
|
20
|
|
-
|
21
|
|
- //String - Animation easing effect
|
22
|
|
- //animationEasing : "easeOutBounce",
|
23
|
|
-
|
24
|
|
- //Boolean - Whether we animate the rotation of the Pie
|
25
|
|
- //animateRotate : true,
|
26
|
|
-
|
27
|
|
- //Boolean - Whether we animate scaling the Pie from the centre
|
28
|
|
- animateScale : false,
|
29
|
|
-
|
30
|
|
- //Function - Will fire on animation completion.
|
31
|
|
- onAnimationComplete : function(){
|
32
|
|
- var Man = new Image();
|
33
|
|
- var Woman = new Image();
|
34
|
|
- Man.src = "css/img/Man.png?" + new Date().getTime();
|
35
|
|
- Woman.src = "css/img/Woman.png?" + new Date().getTime();
|
36
|
|
- Man.onload = function() {
|
37
|
|
- ctx.drawImage(Man, 151, 70, 20, 50);
|
38
|
|
- }
|
39
|
|
- Woman.onload = function() {
|
40
|
|
- ctx.drawImage(Woman, 9, 70, 20, 50);
|
41
|
|
- }
|
42
|
|
- var Pop = parseInt(PopMan) + parseInt(PopWoman);
|
43
|
|
- var PerPopMan = Math.round(parseInt(PopMan) / parseInt(Pop) * 100);
|
44
|
|
- var PerPopWoman = Math.round(parseInt(PopWoman) / parseInt(Pop) * 100);
|
45
|
|
-
|
46
|
|
- var PopMan_text = document.getElementById("PopMan_text");
|
47
|
|
- var PopWoman_text = document.getElementById("PopWoman_text");
|
48
|
|
- var PerPopMan_text = document.getElementById("PerPopMan_text");
|
49
|
|
- var PerPopWoman_text = document.getElementById("PerPopWoman_text");
|
50
|
|
-
|
51
|
|
- PerPopMan_text.innerHTML = PerPopMan + "%";
|
52
|
|
- PerPopWoman_text.innerHTML = PerPopWoman + "%";
|
53
|
|
-
|
54
|
|
- PopMan_text.style.display = "block";
|
55
|
|
- PopWoman_text.style.display = "block";
|
56
|
|
- PerPopMan_text.style.display = "block";
|
57
|
|
- PerPopWoman_text.style.display = "block";
|
58
|
|
-
|
59
|
|
- }
|
|
14
|
+ //Boolean - Whether we should animate the chart
|
|
15
|
+ animation: true,
|
|
16
|
+
|
|
17
|
+ //Number - Amount of animation steps
|
|
18
|
+ animationSteps: 100,
|
|
19
|
+
|
|
20
|
+ //String - Animation easing effect
|
|
21
|
+ //animationEasing : "easeOutBounce",
|
|
22
|
+
|
|
23
|
+ //Boolean - Whether we animate the rotation of the Pie
|
|
24
|
+ //animateRotate : true,
|
|
25
|
+
|
|
26
|
+ //Boolean - Whether we animate scaling the Pie from the centre
|
|
27
|
+ animateScale: false,
|
|
28
|
+
|
|
29
|
+ //Function - Will fire on animation completion.
|
|
30
|
+ onAnimationComplete: function () {
|
|
31
|
+ var Man = new Image();
|
|
32
|
+ var Woman = new Image();
|
|
33
|
+ Man.src = "css/img/Man.png?" + new Date().getTime();
|
|
34
|
+ Woman.src = "css/img/Woman.png?" + new Date().getTime();
|
|
35
|
+ Man.onload = function () {
|
|
36
|
+ ctx.drawImage(Man, 151, 70, 20, 50);
|
|
37
|
+ }
|
|
38
|
+ Woman.onload = function () {
|
|
39
|
+ ctx.drawImage(Woman, 9, 70, 20, 50);
|
|
40
|
+ }
|
|
41
|
+ var Pop = parseInt(PopMan) + parseInt(PopWoman);
|
|
42
|
+ var PerPopMan = Math.round(parseInt(PopMan) / parseInt(Pop) * 100);
|
|
43
|
+ var PerPopWoman = Math.round(parseInt(PopWoman) / parseInt(Pop) * 100);
|
|
44
|
+
|
|
45
|
+ var PopMan_text = document.getElementById("PopMan_text");
|
|
46
|
+ var PopWoman_text = document.getElementById("PopWoman_text");
|
|
47
|
+ var PerPopMan_text = document.getElementById("PerPopMan_text");
|
|
48
|
+ var PerPopWoman_text = document.getElementById("PerPopWoman_text");
|
|
49
|
+
|
|
50
|
+ PerPopMan_text.innerHTML = PerPopMan + "%";
|
|
51
|
+ PerPopWoman_text.innerHTML = PerPopWoman + "%";
|
|
52
|
+
|
|
53
|
+ PopMan_text.style.display = "block";
|
|
54
|
+ PopWoman_text.style.display = "block";
|
|
55
|
+ PerPopMan_text.style.display = "block";
|
|
56
|
+ PerPopWoman_text.style.display = "block";
|
|
57
|
+
|
|
58
|
+ }
|
60
|
59
|
|
61
|
60
|
};
|
62
|
61
|
var ctx = null;
|
63
|
62
|
var NewChart = null;
|
64
|
|
-function piechart1(){
|
65
|
|
- ctx = $("#Maletofemaleratio").get(0).getContext("2d"),//Canvasのコンテキスト取得
|
66
|
|
- NewChart = new Chart(ctx);//チャートを生成
|
67
|
63
|
|
68
|
|
- NewChart.Pie(data,options);
|
|
64
|
+function piechart1() {
|
|
65
|
+ ctx = $("#Maletofemaleratio").get(0).getContext("2d"), //Canvasのコンテキスト取得
|
|
66
|
+ NewChart = new Chart(ctx); //チャートを生成
|
|
67
|
+
|
|
68
|
+ NewChart.Pie(data, options);
|
69
|
69
|
}
|
70
|
70
|
|
71
|
71
|
/* オンロード時に動作 */
|
72
|
|
-if(window.addEventListener) {
|
73
|
|
- window.addEventListener('load', piechart1, false);
|
|
72
|
+if (window.addEventListener) {
|
|
73
|
+ window.addEventListener('load', piechart1, false);
|
74
|
74
|
} else {
|
75
|
|
- window.attachEvent("onload", piechart1);
|
76
|
|
-}
|
|
75
|
+ window.attachEvent("onload", piechart1);
|
|
76
|
+}
|