-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathAreaChartCtrl.js
146 lines (140 loc) · 3.12 KB
/
AreaChartCtrl.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/**
* @author v.lugovsky
* created on 16.12.2015
*/
(function () {
'use strict';
angular.module('BlurAdmin.pages.charts.amCharts')
.controller('AreaChartCtrl', AreaChartCtrl);
/** @ngInject */
function AreaChartCtrl($scope, layoutColors, $element, layoutPaths) {
var id = $element[0].getAttribute('id');
var areaChart = AmCharts.makeChart(id, {
type: 'serial',
theme: 'blur',
color: layoutColors.defaultText,
dataProvider: [
{
lineColor: layoutColors.info,
date: '2012-01-01',
duration: 408
},
{
date: '2012-01-02',
duration: 482
},
{
date: '2012-01-03',
duration: 562
},
{
date: '2012-01-04',
duration: 379
},
{
lineColor: layoutColors.warning,
date: '2012-01-05',
duration: 501
},
{
date: '2012-01-06',
duration: 443
},
{
date: '2012-01-07',
duration: 405
},
{
date: '2012-01-08',
duration: 309,
lineColor: layoutColors.danger
},
{
date: '2012-01-09',
duration: 287
},
{
date: '2012-01-10',
duration: 485
},
{
date: '2012-01-11',
duration: 890
},
{
date: '2012-01-12',
duration: 810
}
],
balloon: {
cornerRadius: 6,
horizontalPadding: 15,
verticalPadding: 10
},
valueAxes: [
{
duration: 'mm',
durationUnits: {
hh: 'h ',
mm: 'min'
},
gridAlpha: 0.5,
gridColor: layoutColors.border,
}
],
graphs: [
{
bullet: 'square',
bulletBorderAlpha: 1,
bulletBorderThickness: 1,
fillAlphas: 0.5,
fillColorsField: 'lineColor',
legendValueText: '[[value]]',
lineColorField: 'lineColor',
title: 'duration',
valueField: 'duration'
}
],
chartCursor: {
categoryBalloonDateFormat: 'YYYY MMM DD',
cursorAlpha: 0,
fullWidth: true
},
dataDateFormat: 'YYYY-MM-DD',
categoryField: 'date',
categoryAxis: {
dateFormats: [
{
period: 'DD',
format: 'DD'
},
{
period: 'WW',
format: 'MMM DD'
},
{
period: 'MM',
format: 'MMM'
},
{
period: 'YYYY',
format: 'YYYY'
}
],
parseDates: true,
autoGridCount: false,
gridCount: 50,
gridAlpha: 0.5,
gridColor: layoutColors.border,
},
export: {
enabled: true
},
pathToImages: layoutPaths.images.amChart
});
areaChart.addListener('dataUpdated', zoomAreaChart);
function zoomAreaChart() {
areaChart.zoomToDates(new Date(2012, 0, 3), new Date(2012, 0, 11));
}
}
})();