-
Notifications
You must be signed in to change notification settings - Fork 0
/
pie.html
103 lines (99 loc) · 3.62 KB
/
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
<html>
<head>
<title>
Pie chart
</title>
<style>
body {
font-family: Bahnschrift, sans-serif;
}
#pie {
transition: all 0.2s linear;
}
#value {
position: fixed;
background: #000;
transform: scale(0);
transition: all 0.2s linear;
z-index: 100;
}
.tabl {
text-align: center;
border-collapse: collapse;
}
.tabl tr {
border-bottom: 1px solid #ccc;
}
.tabl tr:nth-child(even) {
background: #f9f9f9;
}
#val {
position: absolute;
}
#pie.hover #value{
transform: scale(1);
}
</style>
</head>
<body>
<center ng-app="ApplicationPie">
<canvas id="pie">
</canvas>
<canvas id="val"></canvas>
<p>Name: <input type="text" ng-model="name" /></p>
Your name is <span ng-bind="name"></span>
<!-- <div ng-controller="Controller">Yo {{saveit}}</div> -->
<br /><br />
<div ng-controller="controlEverything">
<div ng-init="dict = [{locale:'en-US',name:'United States'}, {locale:'en-GB',name:'United Kingdom'}, {locale:'en-FR',name:'France'}]">
<table width="300" class="tabl">
<tr>
<th>Locale</th>
<th>Country Name</th>
</tr>
<tr ng-repeat="val in dict">
<td>{{ val.locale }}</td>
<td>{{ val.name }}</td>
</tr>
</table>
</div>
<br />
<div ng-init="variable = getMember(dataPoints); col = getMember(colors)">
<table width="300" class="tabl">
<tr>
<th>Colors</th>
<th>Activities</th>
<th>% of Activity</th>
<!-- <th>Country Name</th> -->
</tr>
<tr ng-repeat="(key, val) in variable">
<td><span ng-style="{'background': '{{col[key]}}'}"> </span></td>
<td>{{ key }}</td>
<td>{{ val }}%</td>
</tr>
</table>
</div>
<div id="file"></div>
</center>
</body>
<script src="javascript/diagrams/pie.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script type='text/javascript'>
// console.log(dataPoints);
var Colors = returnColors();
angular.module("ApplicationPie", []).controller("controlEverything", ['$scope', '$window', function($scope, $window) {
// $scope.saveit = {};
$scope.saveit = "Wallah accha pie chart hai bhai";
$scope.dataPoints = $window.dataPoints;
$scope.colors = $window.Colors;
for(let color in $scope.colors) {
$scope.colors[color] = $scope.colors[color];
}
console.log("Angular", $scope.colors);
$scope.getMember = function(data) {
console.log(data);
return data;
}
}]);
</script>
</html>