-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectiveHistoricalGraph.js
87 lines (83 loc) · 2.42 KB
/
DirectiveHistoricalGraph.js
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
var weBTrading = angular.module('weBTrading.historical', []);
weBTrading.directive('historicalchart', ['$timeout', function ($timeout)
{
return {
restrict: 'E',
template: "<div><div id='{{historyGraphId}}' class='historicalChart'></div></div>",
replace: true,
scope:
{
accessor: "=",
historicalsharedata: "=",
historyGraphId: "@"
},
link: function (scope, element, attrs)
{
var graph;
$timeout(function ($scope, $element, $attrs)
{
graph = AmCharts.makeChart(scope.historyGraphId,
{
"type": "serial",
"addClassNames": true,
"theme": "light",
"autoMargins": false,
"marginLeft": 30,
"marginRight": 8,
"marginTop": 10,
"marginBottom": 26,
"balloon": {
"adjustBorderColor": false,
"horizontalPadding": 10,
"verticalPadding": 8,
"color": "#ffffff"
},
"dataProvider": scope.historicalsharedata,
"valueAxes":
[{
"axisAlpha": 0,
"position": "left"
}],
"startDuration": 1,
"graphs": [{
"alphaField": "alpha",
"balloonText": "<span style='font-size:12px;'>[[title]] in [[category]]:<br><span style='font-size:20px;'>[[value]]</span> [[additional]]</span>",
"fillAlphas": 1,
"title": "TransactionPL",
"type": "column",
"valueField": "TransactionPL",
"dashLengthField": "dashLengthColumn"
}, {
"id": "graph2",
"balloonText": "<span style='font-size:12px;'>[[title]] in [[category]]:<br><span style='font-size:20px;'>[[value]]</span> [[additional]]</span>",
"bullet": "round",
"lineThickness": 3,
"bulletSize": 7,
"bulletBorderAlpha": 1,
"bulletColor": "#FFFFFF",
"useLineColorForBulletBorder": true,
"bulletBorderThickness": 3,
"fillAlphas": 0,
"lineAlpha": 1,
"title": "Duration",
"valueField": "Duration"
}],
"categoryField": "DateTime",
"categoryAxis": {
"gridPosition": "start",
"axisAlpha": 0,
"tickLength": 0
},
"export": {
"enabled": true
}
});
});
scope.accessor.refreshHistoricalGraph = function ()
{
graph.dataProvider = scope.historicalsharedata;
graph.validateData();
};
}
};
}]);