Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/buildyourownbotnet/assets/js/easy-pie-chart/src/angular.directive.js
1293 views
1
(function (angular) {
2
3
'use strict';
4
5
return angular.module('easypiechart', [])
6
7
.directive('easypiechart', [function() {
8
return {
9
restrict: 'AE',
10
require: '?ngModel',
11
scope: {
12
percent: '=',
13
options: '='
14
},
15
link: function (scope, element, attrs) {
16
17
scope.percent = scope.percent || 0;
18
19
/**
20
* default easy pie chart options
21
* @type {Object}
22
*/
23
var options = {
24
barColor: '#ef1e25',
25
trackColor: '#f9f9f9',
26
scaleColor: '#dfe0e0',
27
scaleLength: 5,
28
lineCap: 'round',
29
lineWidth: 3,
30
size: 110,
31
rotate: 0,
32
animate: {
33
duration: 1000,
34
enabled: true
35
}
36
};
37
scope.options = angular.extend(options, scope.options);
38
39
var pieChart = new EasyPieChart(element[0], options);
40
41
scope.$watch('percent', function(newVal, oldVal) {
42
pieChart.update(newVal);
43
});
44
}
45
};
46
}]);
47
48
})(angular);
49
50