-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular-rickshaw.js
More file actions
30 lines (29 loc) · 880 Bytes
/
Copy pathangular-rickshaw.js
File metadata and controls
30 lines (29 loc) · 880 Bytes
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
'use strict';
angular.module('stanley-gu.angular-rickshaw', []).directive('rickshaw', function() {
return {
template: '<div></div>',
restrict: 'E',
scope: {
data: '='
},
link: function postLink(scope, element, attrs) {
scope.$watch('data', function(newVal, oldVal) {
if (!newVal) {
return;
}
element[0].innerHTML = '';
var graph = new Rickshaw.Graph({
element: element[0],
width: attrs.width,
height: attrs.height,
series: scope.data,
renderer: 'line'
});
var hoverDetail = new Rickshaw.Graph.HoverDetail({
graph: graph
});
graph.render();
});
}
};
});