@agorapulse/ui-charts 2.2.16 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agorapulse-ui-charts-13.0.0.tgz +0 -0
- package/agorapulse-ui-charts.d.ts +1 -0
- package/{esm2015/agorapulse-ui-charts.js → esm2020/agorapulse-ui-charts.mjs} +0 -0
- package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/esm2020/src/lib/agorapulse-ui-charts.module.mjs +60 -0
- package/esm2020/src/lib/chart-bar/chart-bar-options.model.mjs +80 -0
- package/esm2020/src/lib/chart-bar/chart-bar.component.mjs +58 -0
- package/{esm2015/src/lib/chart-colors.js → esm2020/src/lib/chart-colors.mjs} +3 -2
- package/esm2020/src/lib/chart-column/chart-column-options.model.mjs +104 -0
- package/esm2020/src/lib/chart-column/chart-column.component.mjs +59 -0
- package/{esm2015/src/lib/chart-heatmap/chart-heatmap-options.model.js → esm2020/src/lib/chart-heatmap/chart-heatmap-options.model.mjs} +0 -0
- package/esm2020/src/lib/chart-heatmap/chart-heatmap.component.mjs +55 -0
- package/{esm2015/src/lib/chart-metric.js → esm2020/src/lib/chart-metric.mjs} +0 -0
- package/esm2020/src/lib/chart-metrics-list/chart-metrics-list.component.mjs +23 -0
- package/{esm2015/src/lib/chart-options.js → esm2020/src/lib/chart-options.mjs} +0 -0
- package/esm2020/src/lib/chart-pie/chart-pie-options.model.mjs +121 -0
- package/esm2020/src/lib/chart-pie/chart-pie.component.mjs +56 -0
- package/esm2020/src/lib/chart-spline/chart-spline-options.model.mjs +24 -0
- package/esm2020/src/lib/chart-spline/chart-spline.component.mjs +53 -0
- package/{esm2015/src/lib/highchart-series.model.js → esm2020/src/lib/highchart-series.model.mjs} +0 -0
- package/{esm2015/src/lib/highcharts-border-radius-plugin.js → esm2020/src/lib/highcharts-border-radius-plugin.mjs} +0 -0
- package/fesm2015/agorapulse-ui-charts.mjs +1088 -0
- package/fesm2015/agorapulse-ui-charts.mjs.map +1 -0
- package/fesm2020/agorapulse-ui-charts.mjs +1089 -0
- package/fesm2020/agorapulse-ui-charts.mjs.map +1 -0
- package/package.json +26 -13
- package/src/lib/agorapulse-ui-charts.module.d.ts +13 -0
- package/src/lib/chart-bar/chart-bar.component.d.ts +4 -1
- package/src/lib/chart-colors.d.ts +1 -0
- package/src/lib/chart-column/chart-column.component.d.ts +4 -1
- package/src/lib/chart-heatmap/chart-heatmap.component.d.ts +3 -0
- package/src/lib/chart-metrics-list/chart-metrics-list.component.d.ts +3 -0
- package/src/lib/chart-pie/chart-pie.component.d.ts +3 -0
- package/src/lib/chart-spline/chart-spline-options.model.d.ts +1 -1
- package/src/lib/chart-spline/chart-spline.component.d.ts +3 -0
- package/agorapulse-ui-charts-2.2.16.tgz +0 -0
- package/agorapulse-ui-charts.metadata.json +0 -1
- package/bundles/agorapulse-ui-charts.umd.js +0 -1378
- package/bundles/agorapulse-ui-charts.umd.js.map +0 -1
- package/esm2015/src/lib/agorapulse-ui-charts.module.js +0 -39
- package/esm2015/src/lib/chart-bar/chart-bar-options.model.js +0 -77
- package/esm2015/src/lib/chart-bar/chart-bar.component.js +0 -52
- package/esm2015/src/lib/chart-column/chart-column-options.model.js +0 -103
- package/esm2015/src/lib/chart-column/chart-column.component.js +0 -54
- package/esm2015/src/lib/chart-heatmap/chart-heatmap.component.js +0 -50
- package/esm2015/src/lib/chart-metrics-list/chart-metrics-list.component.js +0 -21
- package/esm2015/src/lib/chart-pie/chart-pie-options.model.js +0 -55
- package/esm2015/src/lib/chart-pie/chart-pie.component.js +0 -51
- package/esm2015/src/lib/chart-spline/chart-spline-options.model.js +0 -24
- package/esm2015/src/lib/chart-spline/chart-spline.component.js +0 -54
- package/fesm2015/agorapulse-ui-charts.js +0 -981
- package/fesm2015/agorapulse-ui-charts.js.map +0 -1
|
@@ -0,0 +1,1089 @@
|
|
|
1
|
+
import * as Highcharts from 'highcharts';
|
|
2
|
+
import { dateFormat, Chart } from 'highcharts';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Component, ViewChild, Input, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
5
|
+
import * as i3 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import * as i1 from '@angular/material/list';
|
|
8
|
+
import { MatListModule } from '@angular/material/list';
|
|
9
|
+
import { HighchartsChartModule } from 'highcharts-angular';
|
|
10
|
+
import * as i2 from '@angular/material/divider';
|
|
11
|
+
import { mapChart } from 'highcharts/highmaps';
|
|
12
|
+
|
|
13
|
+
const borderRadiusPlugin = function (H) {
|
|
14
|
+
if (H.borderRadiusPlugininitialized) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
H.borderRadiusPlugininitialized = true;
|
|
18
|
+
H.wrap(H.seriesTypes.column.prototype, 'translate', function (proceed) {
|
|
19
|
+
const options = this.options;
|
|
20
|
+
const topMargin = options.topMargin || 0;
|
|
21
|
+
const bottomMargin = options.bottomMargin || 0;
|
|
22
|
+
const borderRadiusTopLeftSettings = options.borderRadiusTopLeft;
|
|
23
|
+
const borderRadiusTopRightSettings = options.borderRadiusTopRight;
|
|
24
|
+
const borderRadiusBottomLeftSettings = options.borderRadiusBottomLeft;
|
|
25
|
+
const borderRadiusBottomRightSettings = options.borderRadiusBottomRight;
|
|
26
|
+
proceed.call(this);
|
|
27
|
+
if (!this.points) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.points.forEach(function (point) {
|
|
31
|
+
if (borderRadiusTopLeftSettings || borderRadiusTopRightSettings || borderRadiusBottomLeftSettings || borderRadiusBottomRightSettings) {
|
|
32
|
+
const w = point.shapeArgs.width;
|
|
33
|
+
const h = point.shapeArgs.height;
|
|
34
|
+
const x = point.shapeArgs.x;
|
|
35
|
+
const y = point.shapeArgs.y;
|
|
36
|
+
const borderRadiusTopLeft = (borderRadiusTopLeftSettings && borderRadiusTopLeftSettings.length) ? borderRadiusTopLeftSettings[point.index] : borderRadiusTopLeftSettings || 0;
|
|
37
|
+
const borderRadiusTopRight = (borderRadiusTopRightSettings && borderRadiusTopRightSettings.length) ? borderRadiusTopRightSettings[point.index] : borderRadiusTopRightSettings || 0;
|
|
38
|
+
const borderRadiusBottomLeft = (borderRadiusBottomLeftSettings && borderRadiusBottomLeftSettings.length) ? borderRadiusBottomLeftSettings[point.index] : borderRadiusBottomLeftSettings || 0;
|
|
39
|
+
const borderRadiusBottomRight = (borderRadiusBottomRightSettings && borderRadiusBottomRightSettings.length) ? borderRadiusBottomRightSettings[point.index] : borderRadiusBottomRightSettings || 0;
|
|
40
|
+
let radiusTopLeft = H.relativeLength(borderRadiusTopLeft, w);
|
|
41
|
+
let radiusTopRight = H.relativeLength(borderRadiusTopRight, w);
|
|
42
|
+
let radiusBottomRight = H.relativeLength(borderRadiusBottomRight, w);
|
|
43
|
+
let radiusBottomLeft = H.relativeLength(borderRadiusBottomLeft, w);
|
|
44
|
+
const maxR = Math.min(w, h) / 2;
|
|
45
|
+
radiusTopLeft = radiusTopLeft > maxR ? maxR : radiusTopLeft;
|
|
46
|
+
radiusTopRight = radiusTopRight > maxR ? maxR : radiusTopRight;
|
|
47
|
+
radiusBottomRight = radiusBottomRight > maxR ? maxR : radiusBottomRight;
|
|
48
|
+
radiusBottomLeft = radiusBottomLeft > maxR ? maxR : radiusBottomLeft;
|
|
49
|
+
point.dlBox = point.shapeArgs;
|
|
50
|
+
point.shapeType = 'path';
|
|
51
|
+
point.shapeArgs = {
|
|
52
|
+
d: [
|
|
53
|
+
'M', x + radiusTopLeft, y + topMargin,
|
|
54
|
+
'L', x + w - radiusTopRight, y + topMargin,
|
|
55
|
+
'C', x + w - radiusTopRight / 2, y, x + w, y + radiusTopRight / 2, x + w, y + radiusTopRight,
|
|
56
|
+
'L', x + w, y + h - radiusBottomRight,
|
|
57
|
+
'C', x + w, y + h - radiusBottomRight / 2, x + w - radiusBottomRight / 2, y + h, x + w - radiusBottomRight, y + h + bottomMargin,
|
|
58
|
+
'L', x + radiusBottomLeft, y + h + bottomMargin,
|
|
59
|
+
'C', x + radiusBottomLeft / 2, y + h, x, y + h - radiusBottomLeft / 2, x, y + h - radiusBottomLeft,
|
|
60
|
+
'L', x, y + radiusTopLeft,
|
|
61
|
+
'C', x, y + radiusTopLeft / 2, x + radiusTopLeft / 2, y, x + radiusTopLeft, y,
|
|
62
|
+
'Z'
|
|
63
|
+
]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var ChartColor;
|
|
71
|
+
(function (ChartColor) {
|
|
72
|
+
ChartColor[ChartColor["Grey"] = 0] = "Grey";
|
|
73
|
+
ChartColor[ChartColor["Orange"] = 1] = "Orange";
|
|
74
|
+
ChartColor[ChartColor["SoftBlue"] = 2] = "SoftBlue";
|
|
75
|
+
ChartColor[ChartColor["ElectricBlue"] = 3] = "ElectricBlue";
|
|
76
|
+
ChartColor[ChartColor["Purple"] = 4] = "Purple";
|
|
77
|
+
ChartColor[ChartColor["Green"] = 5] = "Green";
|
|
78
|
+
})(ChartColor || (ChartColor = {}));
|
|
79
|
+
class ChartColors {
|
|
80
|
+
static getChartColors(color) {
|
|
81
|
+
switch (color) {
|
|
82
|
+
case ChartColor.Orange:
|
|
83
|
+
return this.ORANGE_COLORS;
|
|
84
|
+
case ChartColor.SoftBlue:
|
|
85
|
+
return this.SOFT_BLUE_COLORS;
|
|
86
|
+
case ChartColor.ElectricBlue:
|
|
87
|
+
return this.ELECTRIC_BLUE_COLORS;
|
|
88
|
+
case ChartColor.Purple:
|
|
89
|
+
return this.PURPLE_COLORS;
|
|
90
|
+
case ChartColor.Green:
|
|
91
|
+
return this.GREEN_COLORS;
|
|
92
|
+
default:
|
|
93
|
+
return this.GREY_COLORS;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
static getColors(seriesCount, color) {
|
|
97
|
+
const colors = this.getChartColors(color);
|
|
98
|
+
switch (seriesCount) {
|
|
99
|
+
case 1:
|
|
100
|
+
return [colors[100]];
|
|
101
|
+
case 2:
|
|
102
|
+
return [colors[40], colors[100]];
|
|
103
|
+
case 3:
|
|
104
|
+
return [colors[20], colors[60], colors[100]];
|
|
105
|
+
case 4:
|
|
106
|
+
return [colors[20], colors[40], colors[60], colors[100]];
|
|
107
|
+
case 5:
|
|
108
|
+
return [colors[10], colors[20], colors[40], colors[60], colors[100]];
|
|
109
|
+
default:
|
|
110
|
+
return [colors[20], colors[40], colors[60], colors[100]];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
ChartColors.SOFT_BLUE_COLORS = {
|
|
115
|
+
'10': '#EFF5FC',
|
|
116
|
+
'20': '#DFEDFA',
|
|
117
|
+
'40': '#C0DBF4',
|
|
118
|
+
'60': '#A0C8EF',
|
|
119
|
+
'85': '#78B1E8',
|
|
120
|
+
'100': '#61A4E4'
|
|
121
|
+
};
|
|
122
|
+
ChartColors.ELECTRIC_BLUE_COLORS = {
|
|
123
|
+
'10': '#e8f4ff',
|
|
124
|
+
'20': '#d1e8ff',
|
|
125
|
+
'40': '#a2d1ff',
|
|
126
|
+
'60': '#74bbfe',
|
|
127
|
+
'85': '#3a9efe',
|
|
128
|
+
'100': '#178dfe'
|
|
129
|
+
};
|
|
130
|
+
ChartColors.ORANGE_COLORS = {
|
|
131
|
+
'10': '#FFEFE9',
|
|
132
|
+
'20': '#FFE1D4',
|
|
133
|
+
'40': '#FFC2A8',
|
|
134
|
+
'60': '#FFA47D',
|
|
135
|
+
'85': '#FF7E46',
|
|
136
|
+
'100': '#FF6726'
|
|
137
|
+
};
|
|
138
|
+
ChartColors.GREEN_COLORS = {
|
|
139
|
+
'10': '#ECF7ED',
|
|
140
|
+
'20': '#DAF1DD',
|
|
141
|
+
'40': '#B5E3BB',
|
|
142
|
+
'60': '#8FD498',
|
|
143
|
+
'85': '#61C26D',
|
|
144
|
+
'100': '#45B854'
|
|
145
|
+
};
|
|
146
|
+
ChartColors.PURPLE_COLORS = {
|
|
147
|
+
'10': '#EFEDF8',
|
|
148
|
+
'20': '#E0DDF2',
|
|
149
|
+
'40': '#C1BBE6',
|
|
150
|
+
'60': '#A398D9',
|
|
151
|
+
'85': '#7C6DC9',
|
|
152
|
+
'100': '#6554C0'
|
|
153
|
+
};
|
|
154
|
+
ChartColors.GREY_COLORS = {
|
|
155
|
+
'5': '#F5F5F7',
|
|
156
|
+
'10': '#EAECEF',
|
|
157
|
+
'20': '#D6DAE0',
|
|
158
|
+
'40': '#AEB5C1',
|
|
159
|
+
'60': '#858FA1',
|
|
160
|
+
'85': '#5D6A82',
|
|
161
|
+
'100': '#344563'
|
|
162
|
+
};
|
|
163
|
+
ChartColors.BLACK_COLOR = '#000000';
|
|
164
|
+
ChartColors.LIMIT_COLOR = '#E81313';
|
|
165
|
+
ChartColors.WHITE_COLOR = '#FFFFFF';
|
|
166
|
+
|
|
167
|
+
class ChartOptions {
|
|
168
|
+
static build(options) {
|
|
169
|
+
return mergeDeep(ChartOptions.DEFAULT_OPTIONS, options);
|
|
170
|
+
}
|
|
171
|
+
static configure(series, options, color, labelDateFormat) {
|
|
172
|
+
// Configure axis
|
|
173
|
+
options.xAxis = mergeDeep({
|
|
174
|
+
labels: {
|
|
175
|
+
formatter: function () {
|
|
176
|
+
return dateFormat(labelDateFormat ? labelDateFormat : '%m/%d', this.value);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
//minTickInterval: 24 * 60 * 60 * 1000 // One day
|
|
180
|
+
}, options.xAxis);
|
|
181
|
+
// Configure series
|
|
182
|
+
if (series && series.length) {
|
|
183
|
+
options.series = series;
|
|
184
|
+
options.legend.enabled = series.length >= 2;
|
|
185
|
+
options.colors = ChartColors.getColors(series.length, color);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
ChartOptions.DEFAULT_DATE_FORMAT = '%A, %b %e, %Y';
|
|
190
|
+
ChartOptions.DEFAULT_OPTIONS = {
|
|
191
|
+
/*lang: {
|
|
192
|
+
decimalPoint: (manager && manager.locale !== 'en') ? ',' : '.',
|
|
193
|
+
resetZoom: resetZoomLabel,
|
|
194
|
+
resetZoomTitle: resetZoomHtmlTitle,
|
|
195
|
+
shortMonths: [
|
|
196
|
+
shortJanuary, shortFebruary, shortMarch, shortApril, shortMay, shortJune,
|
|
197
|
+
shortJuly, shortAugust, shortSeptember, shortOctober, shortNovember, shortDecember
|
|
198
|
+
],
|
|
199
|
+
thousandsSep: (manager && manager.locale !== 'en') ? ' ' : ',',
|
|
200
|
+
weekdays: this.weekDays,
|
|
201
|
+
zoomIn: zoomInHtmlTitle,
|
|
202
|
+
zoomOut: zoomOutHtmlTitle
|
|
203
|
+
},*/
|
|
204
|
+
chart: {
|
|
205
|
+
spacingRight: 20,
|
|
206
|
+
zoomType: 'xy',
|
|
207
|
+
panning: {
|
|
208
|
+
enabled: true
|
|
209
|
+
},
|
|
210
|
+
panKey: 'shift',
|
|
211
|
+
style: {
|
|
212
|
+
fontFamily: 'Averta, \'Open Sans\', Helvetica, sans-serif'
|
|
213
|
+
},
|
|
214
|
+
resetZoomButton: {
|
|
215
|
+
theme: {
|
|
216
|
+
fill: ChartColors.WHITE_COLOR,
|
|
217
|
+
r: 4,
|
|
218
|
+
style: {
|
|
219
|
+
color: ChartColors.GREY_COLORS[100],
|
|
220
|
+
fontSize: '12px'
|
|
221
|
+
},
|
|
222
|
+
states: {
|
|
223
|
+
hover: {
|
|
224
|
+
fill: ChartColors.GREY_COLORS[5]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
colorAxis: {
|
|
231
|
+
labels: {
|
|
232
|
+
style: {
|
|
233
|
+
color: ChartColors.GREY_COLORS[60]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
credits: {
|
|
238
|
+
enabled: false
|
|
239
|
+
},
|
|
240
|
+
legend: {
|
|
241
|
+
borderWidth: 0,
|
|
242
|
+
itemStyle: {
|
|
243
|
+
color: ChartColors.GREY_COLORS[60],
|
|
244
|
+
fontSize: '14px',
|
|
245
|
+
fontWeight: 'normal'
|
|
246
|
+
},
|
|
247
|
+
itemHoverStyle: {
|
|
248
|
+
color: ChartColors.GREY_COLORS[100],
|
|
249
|
+
fontWeight: 'bold'
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
plotOptions: {
|
|
253
|
+
series: {
|
|
254
|
+
states: {
|
|
255
|
+
hover: {
|
|
256
|
+
brightness: 0
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
connectNulls: true,
|
|
260
|
+
lineWidth: 4
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
navigation: {
|
|
264
|
+
buttonOptions: {
|
|
265
|
+
y: 0
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
title: {
|
|
269
|
+
text: null
|
|
270
|
+
},
|
|
271
|
+
tooltip: {
|
|
272
|
+
backgroundColor: ChartColors.WHITE_COLOR,
|
|
273
|
+
borderRadius: 4,
|
|
274
|
+
borderWidth: 0,
|
|
275
|
+
dateTimeLabelFormats: {
|
|
276
|
+
day: ChartOptions.DEFAULT_DATE_FORMAT,
|
|
277
|
+
week: ChartOptions.DEFAULT_DATE_FORMAT
|
|
278
|
+
},
|
|
279
|
+
shadow: {
|
|
280
|
+
color: ChartColors.BLACK_COLOR,
|
|
281
|
+
offsetX: 0,
|
|
282
|
+
offsetY: 2,
|
|
283
|
+
opacity: 0.02,
|
|
284
|
+
width: 6
|
|
285
|
+
},
|
|
286
|
+
split: false,
|
|
287
|
+
shared: true,
|
|
288
|
+
useHTML: true,
|
|
289
|
+
headerFormat: `<div style="border-bottom: 1px solid ${ChartColors.GREY_COLORS[10]}; padding: 0 8px 7px">`
|
|
290
|
+
+ `<span style="font-size: 12px; color: ${ChartColors.GREY_COLORS[60]}">{point.key}</span></div>`,
|
|
291
|
+
pointFormat: `<div style="font-size: 14px; color: ${ChartColors.GREY_COLORS[100]}; margin: 6px 8px 0 8px;">`
|
|
292
|
+
+ '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}</b></div>'
|
|
293
|
+
},
|
|
294
|
+
xAxis: {
|
|
295
|
+
gridLineColor: ChartColors.GREY_COLORS[10],
|
|
296
|
+
lineColor: ChartColors.GREY_COLORS[10],
|
|
297
|
+
tickColor: ChartColors.GREY_COLORS[10],
|
|
298
|
+
gridLineWidth: 1,
|
|
299
|
+
title: {
|
|
300
|
+
text: null
|
|
301
|
+
},
|
|
302
|
+
labels: {
|
|
303
|
+
style: {
|
|
304
|
+
color: ChartColors.GREY_COLORS[40],
|
|
305
|
+
fontSize: '12px'
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
yAxis: {
|
|
310
|
+
allowDecimals: false,
|
|
311
|
+
gridLineColor: ChartColors.GREY_COLORS[10],
|
|
312
|
+
lineColor: ChartColors.GREY_COLORS[10],
|
|
313
|
+
gridLineWidth: 1,
|
|
314
|
+
title: {
|
|
315
|
+
text: null
|
|
316
|
+
},
|
|
317
|
+
labels: {
|
|
318
|
+
style: {
|
|
319
|
+
color: ChartColors.GREY_COLORS[40],
|
|
320
|
+
fontSize: '12px'
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
function isObject(item) {
|
|
326
|
+
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
327
|
+
}
|
|
328
|
+
function mergeDeep(target, source) {
|
|
329
|
+
let output = deepCopy(target);
|
|
330
|
+
if (isObject(target) && isObject(source)) {
|
|
331
|
+
Object.keys(source).forEach(key => {
|
|
332
|
+
if (isObject(source[key])) {
|
|
333
|
+
if (!(key in target))
|
|
334
|
+
Object.assign(output, { [key]: source[key] });
|
|
335
|
+
else
|
|
336
|
+
output[key] = mergeDeep(target[key], source[key]);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
Object.assign(output, { [key]: source[key] });
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
return output;
|
|
344
|
+
}
|
|
345
|
+
function deepCopy(source) {
|
|
346
|
+
if (typeof source !== "object" || source === null) {
|
|
347
|
+
return source; // Return the value if source is not an object
|
|
348
|
+
}
|
|
349
|
+
// Create an array or object to hold the values
|
|
350
|
+
const newObject = Array.isArray(source) ? [] : {};
|
|
351
|
+
for (let key in source) {
|
|
352
|
+
if (source.hasOwnProperty(key)) {
|
|
353
|
+
// Recursively (deep) copy for nested objects, including arrays
|
|
354
|
+
newObject[key] = deepCopy(source[key]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return newObject;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
class ChartBarOptions extends ChartOptions {
|
|
361
|
+
static build(options) {
|
|
362
|
+
const seriesOptions = {
|
|
363
|
+
borderRadiusTopLeft: 100,
|
|
364
|
+
borderRadiusTopRight: 100,
|
|
365
|
+
borderWidth: 0
|
|
366
|
+
};
|
|
367
|
+
const defaultColumnOptions = {
|
|
368
|
+
chart: {
|
|
369
|
+
type: 'bar'
|
|
370
|
+
},
|
|
371
|
+
xAxis: {
|
|
372
|
+
categories: undefined,
|
|
373
|
+
gridLineWidth: 0,
|
|
374
|
+
lineWidth: 0,
|
|
375
|
+
reversed: false,
|
|
376
|
+
tickWidth: 0,
|
|
377
|
+
labels: {
|
|
378
|
+
align: 'center',
|
|
379
|
+
formatter() {
|
|
380
|
+
if (this.value && this.value.toString().length > 16) {
|
|
381
|
+
return this.value.toString().substring(0, 15) + '...';
|
|
382
|
+
}
|
|
383
|
+
return this.value.toString();
|
|
384
|
+
},
|
|
385
|
+
style: {
|
|
386
|
+
width: 100
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
type: 'category'
|
|
390
|
+
},
|
|
391
|
+
yAxis: {
|
|
392
|
+
type: 'linear',
|
|
393
|
+
minTickInterval: 1
|
|
394
|
+
},
|
|
395
|
+
plotOptions: {
|
|
396
|
+
bar: {
|
|
397
|
+
maxPointWidth: 18,
|
|
398
|
+
pointWidth: 20
|
|
399
|
+
},
|
|
400
|
+
series: seriesOptions
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
return super.build(mergeDeep(defaultColumnOptions, options));
|
|
404
|
+
}
|
|
405
|
+
static configureBar(series, categories, options, opposite, color, labelDateFormat) {
|
|
406
|
+
ChartOptions.configure(series, options, color, labelDateFormat);
|
|
407
|
+
if (categories && categories.length) {
|
|
408
|
+
options.xAxis.categories = categories;
|
|
409
|
+
}
|
|
410
|
+
if (opposite && series.length === 2) {
|
|
411
|
+
const negativeSerie = series[0];
|
|
412
|
+
negativeSerie.borderRadiusBottomLeft = 100;
|
|
413
|
+
negativeSerie.borderRadiusBottomRight = 100;
|
|
414
|
+
negativeSerie.borderRadiusTopLeft = 0;
|
|
415
|
+
negativeSerie.borderRadiusTopRight = 0;
|
|
416
|
+
negativeSerie.data = negativeSerie.data.map((point) => {
|
|
417
|
+
if (point && isNaN(point)) {
|
|
418
|
+
return {
|
|
419
|
+
...point,
|
|
420
|
+
y: -Math.abs(point.y)
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
else if (!isNaN(point)) {
|
|
424
|
+
return -Math.abs(point);
|
|
425
|
+
}
|
|
426
|
+
return point;
|
|
427
|
+
});
|
|
428
|
+
options.plotOptions.series.stacking = 'normal';
|
|
429
|
+
options.yAxis.labels.formatter = function () {
|
|
430
|
+
return Math.abs(+this.value) + '%';
|
|
431
|
+
};
|
|
432
|
+
options.tooltip.pointFormatter = function () {
|
|
433
|
+
return `<div style="font-size: 14px; color: #344563; margin: 6px 8px 0 8px;"><span style="color:${this.color};">\u25CF</span> ${this.series.name}: <b>${Math.abs(this.y) + '%'}</b></div>`;
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
class ChartBarComponent {
|
|
440
|
+
constructor() {
|
|
441
|
+
this.categories = [];
|
|
442
|
+
this.chartOptions = {}; // https://api.highcharts.com/highcharts/
|
|
443
|
+
this.color = ChartColor.ElectricBlue;
|
|
444
|
+
this.lastWidth = 0;
|
|
445
|
+
}
|
|
446
|
+
ngOnChanges(changes) {
|
|
447
|
+
if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
|
|
448
|
+
this.initChart();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
ngAfterViewChecked() {
|
|
452
|
+
if (this.chartRef && this.chartRef.nativeElement.clientWidth != this.lastWidth) {
|
|
453
|
+
this.lastWidth = this.chartRef.nativeElement.clientWidth;
|
|
454
|
+
if (this.chart) {
|
|
455
|
+
this.chart.reflow();
|
|
456
|
+
}
|
|
457
|
+
else if (this.series && this.series.length) {
|
|
458
|
+
this.initChart();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
initChart() {
|
|
463
|
+
if (this.series) {
|
|
464
|
+
const chartOptions = ChartBarOptions.build(this.chartOptions);
|
|
465
|
+
ChartBarOptions.configureBar(this.series, this.categories, chartOptions, this.opposite, this.color, this.labelDateFormat);
|
|
466
|
+
this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/** @nocollapse */ /** @nocollapse */ ChartBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
471
|
+
/** @nocollapse */ /** @nocollapse */ ChartBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: ChartBarComponent, selector: "ap-chart-bar", inputs: { categories: "categories", chartOptions: "chartOptions", color: "color", labelDateFormat: "labelDateFormat", opposite: "opposite", series: "series" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #chart></div>\n" });
|
|
472
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartBarComponent, decorators: [{
|
|
473
|
+
type: Component,
|
|
474
|
+
args: [{ selector: 'ap-chart-bar', template: "<div #chart></div>\n" }]
|
|
475
|
+
}], propDecorators: { chartRef: [{
|
|
476
|
+
type: ViewChild,
|
|
477
|
+
args: ['chart']
|
|
478
|
+
}], categories: [{
|
|
479
|
+
type: Input
|
|
480
|
+
}], chartOptions: [{
|
|
481
|
+
type: Input
|
|
482
|
+
}], color: [{
|
|
483
|
+
type: Input
|
|
484
|
+
}], labelDateFormat: [{
|
|
485
|
+
type: Input
|
|
486
|
+
}], opposite: [{
|
|
487
|
+
type: Input
|
|
488
|
+
}], series: [{
|
|
489
|
+
type: Input
|
|
490
|
+
}] } });
|
|
491
|
+
|
|
492
|
+
class ChartColumnOptions extends ChartOptions {
|
|
493
|
+
static buildColumn(options, simple) {
|
|
494
|
+
const defaultColumnOptions = {
|
|
495
|
+
chart: {
|
|
496
|
+
type: 'column'
|
|
497
|
+
},
|
|
498
|
+
legend: {
|
|
499
|
+
symbolHeight: 10
|
|
500
|
+
},
|
|
501
|
+
plotOptions: {
|
|
502
|
+
column: {
|
|
503
|
+
stacking: 'normal',
|
|
504
|
+
borderWidth: 0,
|
|
505
|
+
maxPointWidth: 20,
|
|
506
|
+
events: {
|
|
507
|
+
hide() {
|
|
508
|
+
ChartColumnOptions.redrawWithRoundedColumns(this.chart);
|
|
509
|
+
},
|
|
510
|
+
show() {
|
|
511
|
+
ChartColumnOptions.redrawWithRoundedColumns(this.chart);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
xAxis: {
|
|
517
|
+
type: 'datetime'
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
const simpleColumnOptions = {
|
|
521
|
+
chart: {
|
|
522
|
+
type: 'column',
|
|
523
|
+
height: '80px'
|
|
524
|
+
},
|
|
525
|
+
credits: {
|
|
526
|
+
enabled: false
|
|
527
|
+
},
|
|
528
|
+
plotOptions: {
|
|
529
|
+
column: {
|
|
530
|
+
events: {
|
|
531
|
+
hide() {
|
|
532
|
+
ChartColumnOptions.redrawWithRoundedColumns(this.chart);
|
|
533
|
+
},
|
|
534
|
+
show() {
|
|
535
|
+
ChartColumnOptions.redrawWithRoundedColumns(this.chart);
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
xAxis: {
|
|
541
|
+
type: 'datetime',
|
|
542
|
+
crosshair: true,
|
|
543
|
+
labels: {
|
|
544
|
+
enabled: false,
|
|
545
|
+
formatter() {
|
|
546
|
+
return dateFormat('%m/%d', +this.value);
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
lineWidth: 0,
|
|
550
|
+
tickWidth: 0,
|
|
551
|
+
gridLineWidth: 0
|
|
552
|
+
},
|
|
553
|
+
yAxis: {
|
|
554
|
+
min: 0,
|
|
555
|
+
labels: {
|
|
556
|
+
enabled: false
|
|
557
|
+
},
|
|
558
|
+
gridLineWidth: 0
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
return super.build(mergeDeep(simple ? simpleColumnOptions : defaultColumnOptions, options));
|
|
562
|
+
}
|
|
563
|
+
static redrawWithRoundedColumns(chart) {
|
|
564
|
+
chart.series.map((serie, serieIndex, arr) => {
|
|
565
|
+
ChartColumnOptions.roundSerie(arr, serie.options, serieIndex);
|
|
566
|
+
});
|
|
567
|
+
chart.redraw(true);
|
|
568
|
+
}
|
|
569
|
+
static roundSerie(series, serie, serieIndex) {
|
|
570
|
+
const roundedOptionMap = [];
|
|
571
|
+
let borderRadius = 0;
|
|
572
|
+
if (serie.data) {
|
|
573
|
+
serie.data.forEach((point, columnIndex) => {
|
|
574
|
+
// Check if all previous stacked data at the same abscissa (located higher on the graph) are missing or have a value of 0
|
|
575
|
+
// if so, it means that this point is the visual top of the column, so we should round it
|
|
576
|
+
const roundedColumnEnabled = series.slice(0, serieIndex)
|
|
577
|
+
.every(otherSerie => {
|
|
578
|
+
if (otherSerie.visible === false) {
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
const pointAtSameAbscissa = otherSerie.options
|
|
582
|
+
.data.find(otherPoint => otherPoint[0] === point[0]);
|
|
583
|
+
return !pointAtSameAbscissa || pointAtSameAbscissa[1] === 0;
|
|
584
|
+
});
|
|
585
|
+
borderRadius = roundedColumnEnabled ? 100 : 0;
|
|
586
|
+
roundedOptionMap[columnIndex] = borderRadius;
|
|
587
|
+
});
|
|
588
|
+
serie.borderRadiusTopLeft = roundedOptionMap;
|
|
589
|
+
serie.borderRadiusTopRight = roundedOptionMap;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
class ChartColumnComponent {
|
|
595
|
+
constructor() {
|
|
596
|
+
this.chartOptions = {}; // https://api.highcharts.com/highcharts/
|
|
597
|
+
this.color = ChartColor.ElectricBlue;
|
|
598
|
+
this.simple = false;
|
|
599
|
+
this.lastWidth = 0;
|
|
600
|
+
}
|
|
601
|
+
ngOnChanges(changes) {
|
|
602
|
+
if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
|
|
603
|
+
this.initChart();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
ngAfterViewChecked() {
|
|
607
|
+
if (this.chartRef && this.chartRef.nativeElement.clientWidth != this.lastWidth) {
|
|
608
|
+
this.lastWidth = this.chartRef.nativeElement.clientWidth;
|
|
609
|
+
if (this.chart) {
|
|
610
|
+
this.chart.reflow();
|
|
611
|
+
}
|
|
612
|
+
else if (this.series && this.series.length) {
|
|
613
|
+
this.initChart();
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
initChart() {
|
|
618
|
+
if (this.series) {
|
|
619
|
+
const chartOptions = ChartColumnOptions.buildColumn(this.chartOptions, this.simple);
|
|
620
|
+
ChartColumnOptions.configure(this.series, chartOptions, this.color, this.labelDateFormat);
|
|
621
|
+
this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
|
|
622
|
+
if (this.chart) {
|
|
623
|
+
ChartColumnOptions.redrawWithRoundedColumns(this.chart);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
/** @nocollapse */ /** @nocollapse */ ChartColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
629
|
+
/** @nocollapse */ /** @nocollapse */ ChartColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: ChartColumnComponent, selector: "ap-chart-column", inputs: { chartOptions: "chartOptions", color: "color", labelDateFormat: "labelDateFormat", series: "series", simple: "simple" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #chart></div>\n" });
|
|
630
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartColumnComponent, decorators: [{
|
|
631
|
+
type: Component,
|
|
632
|
+
args: [{ selector: 'ap-chart-column', template: "<div #chart></div>\n" }]
|
|
633
|
+
}], propDecorators: { chartRef: [{
|
|
634
|
+
type: ViewChild,
|
|
635
|
+
args: ['chart']
|
|
636
|
+
}], chartOptions: [{
|
|
637
|
+
type: Input
|
|
638
|
+
}], color: [{
|
|
639
|
+
type: Input
|
|
640
|
+
}], labelDateFormat: [{
|
|
641
|
+
type: Input
|
|
642
|
+
}], series: [{
|
|
643
|
+
type: Input
|
|
644
|
+
}], simple: [{
|
|
645
|
+
type: Input
|
|
646
|
+
}] } });
|
|
647
|
+
|
|
648
|
+
var ChartMetricType;
|
|
649
|
+
(function (ChartMetricType) {
|
|
650
|
+
ChartMetricType[ChartMetricType["default"] = 0] = "default";
|
|
651
|
+
ChartMetricType[ChartMetricType["total"] = 1] = "total";
|
|
652
|
+
})(ChartMetricType || (ChartMetricType = {}));
|
|
653
|
+
class ChartMetric {
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
class ChartMetricsListComponent {
|
|
657
|
+
constructor() {
|
|
658
|
+
this.ChartMetricType = ChartMetricType;
|
|
659
|
+
this.digitsInfo = '1.0-1';
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
/** @nocollapse */ /** @nocollapse */ ChartMetricsListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartMetricsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
663
|
+
/** @nocollapse */ /** @nocollapse */ ChartMetricsListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: ChartMetricsListComponent, selector: "ap-chart-metrics-list", inputs: { metrics: "metrics", locale: "locale" }, ngImport: i0, template: "<mat-list>\n <ng-container *ngIf=\"metrics\">\n <mat-list-item *ngFor=\"let metric of metrics; let i = index\"\n [ngClass]=\"{'chart-metric-total': metric.type == ChartMetricType.total}\">\n <div class=\"chart-metric-name metric-label\"\n *ngIf=\"!metric.children\">\n {{metric.name}}\n </div>\n <div class=\"chart-metric-name\"\n *ngIf=\"metric.children\">\n <span class=\"metric-label\">\n {{metric.name}}\n </span>\n <span class=\"chart-metric-children\">\n <span *ngFor=\"let item of metric.children\">\n <span class=\"child-label\">{{item.name}}</span>: <span class=\"child-value\">{{item.value}}</span>\n </span>\n </span>\n </div>\n <div class=\"chart-metric-value metric-label\">\n {{metric.value | number: digitsInfo: locale}}\n </div>\n <mat-divider *ngIf=\"i < metrics.length - 1\"></mat-divider>\n </mat-list-item>\n </ng-container>\n</mat-list>\n", styles: ["[color=facebook]{color:#1877f2}[bgcolor=facebook],[hcolor=facebook]:hover{background-color:#1877f2}[border=facebook]{border:1px solid #1877f2}[color=google]{color:#4e85e8}[bgcolor=google],[hcolor=google]:hover{background-color:#4e85e8}[border=google]{border:1px solid #4e85e8}[color=instagram]{color:#e1306c}[bgcolor=instagram],[hcolor=instagram]:hover{background-color:#e1306c}[border=instagram]{border:1px solid #e1306c}[color=instagrammagenta]{color:#c13584}[bgcolor=instagrammagenta],[hcolor=instagrammagenta]:hover{background-color:#c13584}[border=instagrammagenta]{border:1px solid #c13584}[color=instagramblue]{color:#5851db}[bgcolor=instagramblue],[hcolor=instagramblue]:hover{background-color:#5851db}[border=instagramblue]{border:1px solid #5851db}[color=instagrampurple]{color:#833ab4}[bgcolor=instagrampurple],[hcolor=instagrampurple]:hover{background-color:#833ab4}[border=instagrampurple]{border:1px solid #833ab4}[color=instagramorange]{color:#f56040}[bgcolor=instagramorange],[hcolor=instagramorange]:hover{background-color:#f56040}[border=instagramorange]{border:1px solid #f56040}[color=instagramyellow]{color:#ffdc80}[bgcolor=instagramyellow],[hcolor=instagramyellow]:hover{background-color:#ffdc80}[border=instagramyellow]{border:1px solid #ffdc80}[color=linkedin]{color:#2c67bc}[bgcolor=linkedin],[hcolor=linkedin]:hover{background-color:#2c67bc}[border=linkedin]{border:1px solid #2c67bc}[color=twitter]{color:#55acee}[bgcolor=twitter],[hcolor=twitter]:hover{background-color:#55acee}[border=twitter]{border:1px solid #55acee}[color=youtube]{color:red}[bgcolor=youtube],[hcolor=youtube]:hover{background-color:red}[border=youtube]{border:1px solid #ff0000}[color=blood-orange]{color:#ff4d00}[bgcolor=blood-orange],[hcolor=blood-orange]:hover{background-color:#ff4d00}[border=blood-orange]{border:1px solid #ff4d00}[color=pinkish-orange]{color:#ff7b49}[bgcolor=pinkish-orange],[hcolor=pinkish-orange]:hover{background-color:#ff7b49}[border=pinkish-orange]{border:1px solid #ff7b49}[color=charcoal-grey]{color:#2a2f34}[bgcolor=charcoal-grey],[hcolor=charcoal-grey]:hover{background-color:#2a2f34}[border=charcoal-grey]{border:1px solid #2a2f34}[color=azure]{color:#00aeef}[bgcolor=azure],[hcolor=azure]:hover{background-color:#00aeef}[border=azure]{border:1px solid #00aeef}[color=light-azure]{color:#eaf5fd}[bgcolor=light-azure],[hcolor=light-azure]:hover{background-color:#eaf5fd}[border=light-azure]{border:1px solid #eaf5fd}[color=blue-grey]{color:#8d98a9}[bgcolor=blue-grey],[hcolor=blue-grey]:hover{background-color:#8d98a9}[border=blue-grey]{border:1px solid #8d98a9}[color=silver]{color:#ced0da}[bgcolor=silver],[hcolor=silver]:hover{background-color:#ced0da}[border=silver]{border:1px solid #ced0da}[color=pale-grey]{color:#dfe3e9}[bgcolor=pale-grey],[hcolor=pale-grey]:hover{background-color:#dfe3e9}[border=pale-grey]{border:1px solid #dfe3e9}[color=grey-white]{color:#f5f7f8}[bgcolor=grey-white],[hcolor=grey-white]:hover{background-color:#f5f7f8}[border=grey-white]{border:1px solid #f5f7f8}[color=cool-grey]{color:#b4bbc6}[bgcolor=cool-grey],[hcolor=cool-grey]:hover{background-color:#b4bbc6}[border=cool-grey]{border:1px solid #b4bbc6}[color=black]{color:#344563}[bgcolor=black],[hcolor=black]:hover{background-color:#344563}[border=black]{border:1px solid #344563}[color=grey-blue]{color:#68768c}[bgcolor=grey-blue],[hcolor=grey-blue]:hover{background-color:#68768c}[border=grey-blue]{border:1px solid #68768c}[color=strawberry]{color:#f4282d}[bgcolor=strawberry],[hcolor=strawberry]:hover{background-color:#f4282d}[border=strawberry]{border:1px solid #f4282d}[color=light-strawberry]{color:#f8eded}[bgcolor=light-strawberry],[hcolor=light-strawberry]:hover{background-color:#f8eded}[border=light-strawberry]{border:1px solid #f8eded}[color=white]{color:#fff}[bgcolor=white],[hcolor=white]:hover{background-color:#fff}[border=white]{border:1px solid #ffffff}[color=cool-green]{color:#33c15d}[bgcolor=cool-green],[hcolor=cool-green]:hover{background-color:#33c15d}[border=cool-green]{border:1px solid #33c15d}[color=light-green]{color:#ebfaef}[bgcolor=light-green],[hcolor=light-green]:hover{background-color:#ebfaef}[border=light-green]{border:1px solid #ebfaef}[color=transparent]{color:transparent}[bgcolor=transparent],[hcolor=transparent]:hover{background-color:transparent}[border=transparent]{border:1px solid transparent}[color=c0]{color:#a566a5}[bgcolor=c0],[hcolor=c0]:hover{background-color:#a566a5}[border=c0]{border:1px solid #A566A5}[color=c1]{color:#c7ab82}[bgcolor=c1],[hcolor=c1]:hover{background-color:#c7ab82}[border=c1]{border:1px solid #C7AB82}[color=c2]{color:#f2713c}[bgcolor=c2],[hcolor=c2]:hover{background-color:#f2713c}[border=c2]{border:1px solid #F2713C}[color=c3]{color:#ffd006}[bgcolor=c3],[hcolor=c3]:hover{background-color:#ffd006}[border=c3]{border:1px solid #FFD006}[color=c4]{color:#94c5aa}[bgcolor=c4],[hcolor=c4]:hover{background-color:#94c5aa}[border=c4]{border:1px solid #94C5AA}[color=c5]{color:#2a9d8f}[bgcolor=c5],[hcolor=c5]:hover{background-color:#2a9d8f}[border=c5]{border:1px solid #2A9D8F}[color=c6]{color:#78acd8}[bgcolor=c6],[hcolor=c6]:hover{background-color:#78acd8}[border=c6]{border:1px solid #78ACD8}[color=c7]{color:#525a9e}[bgcolor=c7],[hcolor=c7]:hover{background-color:#525a9e}[border=c7]{border:1px solid #525A9E}[color=c8]{color:#6a2459}[bgcolor=c8],[hcolor=c8]:hover{background-color:#6a2459}[border=c8]{border:1px solid #6A2459}[color=c9]{color:#74729e}[bgcolor=c9],[hcolor=c9]:hover{background-color:#74729e}[border=c9]{border:1px solid #74729E}.metric-label{font-size:14px;color:#5d6a82}.chart-metric-total .metric-label{font-size:16px;color:#344563!important;font-weight:700}.chart-metric-name .chart-metric-children{color:#aeb5c1;font-size:14px}.chart-metric-name .chart-metric-children .child-label{margin-left:16px}.chart-metric-value{justify-content:left;flex:1 0 0;flex-direction:row;text-align:end;color:#344563}.mat-list-item{height:35px}.mat-list-item ::ng-deep .mat-list-item-content{padding:0}\n"], components: [{ type: i1.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "number": i3.DecimalPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
664
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartMetricsListComponent, decorators: [{
|
|
665
|
+
type: Component,
|
|
666
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: "ap-chart-metrics-list", template: "<mat-list>\n <ng-container *ngIf=\"metrics\">\n <mat-list-item *ngFor=\"let metric of metrics; let i = index\"\n [ngClass]=\"{'chart-metric-total': metric.type == ChartMetricType.total}\">\n <div class=\"chart-metric-name metric-label\"\n *ngIf=\"!metric.children\">\n {{metric.name}}\n </div>\n <div class=\"chart-metric-name\"\n *ngIf=\"metric.children\">\n <span class=\"metric-label\">\n {{metric.name}}\n </span>\n <span class=\"chart-metric-children\">\n <span *ngFor=\"let item of metric.children\">\n <span class=\"child-label\">{{item.name}}</span>: <span class=\"child-value\">{{item.value}}</span>\n </span>\n </span>\n </div>\n <div class=\"chart-metric-value metric-label\">\n {{metric.value | number: digitsInfo: locale}}\n </div>\n <mat-divider *ngIf=\"i < metrics.length - 1\"></mat-divider>\n </mat-list-item>\n </ng-container>\n</mat-list>\n", styles: ["[color=facebook]{color:#1877f2}[bgcolor=facebook],[hcolor=facebook]:hover{background-color:#1877f2}[border=facebook]{border:1px solid #1877f2}[color=google]{color:#4e85e8}[bgcolor=google],[hcolor=google]:hover{background-color:#4e85e8}[border=google]{border:1px solid #4e85e8}[color=instagram]{color:#e1306c}[bgcolor=instagram],[hcolor=instagram]:hover{background-color:#e1306c}[border=instagram]{border:1px solid #e1306c}[color=instagrammagenta]{color:#c13584}[bgcolor=instagrammagenta],[hcolor=instagrammagenta]:hover{background-color:#c13584}[border=instagrammagenta]{border:1px solid #c13584}[color=instagramblue]{color:#5851db}[bgcolor=instagramblue],[hcolor=instagramblue]:hover{background-color:#5851db}[border=instagramblue]{border:1px solid #5851db}[color=instagrampurple]{color:#833ab4}[bgcolor=instagrampurple],[hcolor=instagrampurple]:hover{background-color:#833ab4}[border=instagrampurple]{border:1px solid #833ab4}[color=instagramorange]{color:#f56040}[bgcolor=instagramorange],[hcolor=instagramorange]:hover{background-color:#f56040}[border=instagramorange]{border:1px solid #f56040}[color=instagramyellow]{color:#ffdc80}[bgcolor=instagramyellow],[hcolor=instagramyellow]:hover{background-color:#ffdc80}[border=instagramyellow]{border:1px solid #ffdc80}[color=linkedin]{color:#2c67bc}[bgcolor=linkedin],[hcolor=linkedin]:hover{background-color:#2c67bc}[border=linkedin]{border:1px solid #2c67bc}[color=twitter]{color:#55acee}[bgcolor=twitter],[hcolor=twitter]:hover{background-color:#55acee}[border=twitter]{border:1px solid #55acee}[color=youtube]{color:red}[bgcolor=youtube],[hcolor=youtube]:hover{background-color:red}[border=youtube]{border:1px solid #ff0000}[color=blood-orange]{color:#ff4d00}[bgcolor=blood-orange],[hcolor=blood-orange]:hover{background-color:#ff4d00}[border=blood-orange]{border:1px solid #ff4d00}[color=pinkish-orange]{color:#ff7b49}[bgcolor=pinkish-orange],[hcolor=pinkish-orange]:hover{background-color:#ff7b49}[border=pinkish-orange]{border:1px solid #ff7b49}[color=charcoal-grey]{color:#2a2f34}[bgcolor=charcoal-grey],[hcolor=charcoal-grey]:hover{background-color:#2a2f34}[border=charcoal-grey]{border:1px solid #2a2f34}[color=azure]{color:#00aeef}[bgcolor=azure],[hcolor=azure]:hover{background-color:#00aeef}[border=azure]{border:1px solid #00aeef}[color=light-azure]{color:#eaf5fd}[bgcolor=light-azure],[hcolor=light-azure]:hover{background-color:#eaf5fd}[border=light-azure]{border:1px solid #eaf5fd}[color=blue-grey]{color:#8d98a9}[bgcolor=blue-grey],[hcolor=blue-grey]:hover{background-color:#8d98a9}[border=blue-grey]{border:1px solid #8d98a9}[color=silver]{color:#ced0da}[bgcolor=silver],[hcolor=silver]:hover{background-color:#ced0da}[border=silver]{border:1px solid #ced0da}[color=pale-grey]{color:#dfe3e9}[bgcolor=pale-grey],[hcolor=pale-grey]:hover{background-color:#dfe3e9}[border=pale-grey]{border:1px solid #dfe3e9}[color=grey-white]{color:#f5f7f8}[bgcolor=grey-white],[hcolor=grey-white]:hover{background-color:#f5f7f8}[border=grey-white]{border:1px solid #f5f7f8}[color=cool-grey]{color:#b4bbc6}[bgcolor=cool-grey],[hcolor=cool-grey]:hover{background-color:#b4bbc6}[border=cool-grey]{border:1px solid #b4bbc6}[color=black]{color:#344563}[bgcolor=black],[hcolor=black]:hover{background-color:#344563}[border=black]{border:1px solid #344563}[color=grey-blue]{color:#68768c}[bgcolor=grey-blue],[hcolor=grey-blue]:hover{background-color:#68768c}[border=grey-blue]{border:1px solid #68768c}[color=strawberry]{color:#f4282d}[bgcolor=strawberry],[hcolor=strawberry]:hover{background-color:#f4282d}[border=strawberry]{border:1px solid #f4282d}[color=light-strawberry]{color:#f8eded}[bgcolor=light-strawberry],[hcolor=light-strawberry]:hover{background-color:#f8eded}[border=light-strawberry]{border:1px solid #f8eded}[color=white]{color:#fff}[bgcolor=white],[hcolor=white]:hover{background-color:#fff}[border=white]{border:1px solid #ffffff}[color=cool-green]{color:#33c15d}[bgcolor=cool-green],[hcolor=cool-green]:hover{background-color:#33c15d}[border=cool-green]{border:1px solid #33c15d}[color=light-green]{color:#ebfaef}[bgcolor=light-green],[hcolor=light-green]:hover{background-color:#ebfaef}[border=light-green]{border:1px solid #ebfaef}[color=transparent]{color:transparent}[bgcolor=transparent],[hcolor=transparent]:hover{background-color:transparent}[border=transparent]{border:1px solid transparent}[color=c0]{color:#a566a5}[bgcolor=c0],[hcolor=c0]:hover{background-color:#a566a5}[border=c0]{border:1px solid #A566A5}[color=c1]{color:#c7ab82}[bgcolor=c1],[hcolor=c1]:hover{background-color:#c7ab82}[border=c1]{border:1px solid #C7AB82}[color=c2]{color:#f2713c}[bgcolor=c2],[hcolor=c2]:hover{background-color:#f2713c}[border=c2]{border:1px solid #F2713C}[color=c3]{color:#ffd006}[bgcolor=c3],[hcolor=c3]:hover{background-color:#ffd006}[border=c3]{border:1px solid #FFD006}[color=c4]{color:#94c5aa}[bgcolor=c4],[hcolor=c4]:hover{background-color:#94c5aa}[border=c4]{border:1px solid #94C5AA}[color=c5]{color:#2a9d8f}[bgcolor=c5],[hcolor=c5]:hover{background-color:#2a9d8f}[border=c5]{border:1px solid #2A9D8F}[color=c6]{color:#78acd8}[bgcolor=c6],[hcolor=c6]:hover{background-color:#78acd8}[border=c6]{border:1px solid #78ACD8}[color=c7]{color:#525a9e}[bgcolor=c7],[hcolor=c7]:hover{background-color:#525a9e}[border=c7]{border:1px solid #525A9E}[color=c8]{color:#6a2459}[bgcolor=c8],[hcolor=c8]:hover{background-color:#6a2459}[border=c8]{border:1px solid #6A2459}[color=c9]{color:#74729e}[bgcolor=c9],[hcolor=c9]:hover{background-color:#74729e}[border=c9]{border:1px solid #74729E}.metric-label{font-size:14px;color:#5d6a82}.chart-metric-total .metric-label{font-size:16px;color:#344563!important;font-weight:700}.chart-metric-name .chart-metric-children{color:#aeb5c1;font-size:14px}.chart-metric-name .chart-metric-children .child-label{margin-left:16px}.chart-metric-value{justify-content:left;flex:1 0 0;flex-direction:row;text-align:end;color:#344563}.mat-list-item{height:35px}.mat-list-item ::ng-deep .mat-list-item-content{padding:0}\n"] }]
|
|
667
|
+
}], propDecorators: { metrics: [{
|
|
668
|
+
type: Input
|
|
669
|
+
}], locale: [{
|
|
670
|
+
type: Input
|
|
671
|
+
}] } });
|
|
672
|
+
|
|
673
|
+
class ChartHeatmapOptions extends ChartOptions {
|
|
674
|
+
static build(options) {
|
|
675
|
+
const defaultHeatmapOptions = {
|
|
676
|
+
chart: {
|
|
677
|
+
type: 'heatmap',
|
|
678
|
+
height: 600
|
|
679
|
+
},
|
|
680
|
+
colorAxis: {
|
|
681
|
+
allowDecimals: false,
|
|
682
|
+
gridLineWidth: 2,
|
|
683
|
+
gridLineColor: 'white',
|
|
684
|
+
min: 0,
|
|
685
|
+
labels: {
|
|
686
|
+
style: {
|
|
687
|
+
fontSize: '12px'
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
legend: {
|
|
692
|
+
enabled: false
|
|
693
|
+
},
|
|
694
|
+
plotOptions: {
|
|
695
|
+
heatmap: {
|
|
696
|
+
borderColor: ChartColors.GREY_COLORS[10],
|
|
697
|
+
borderWidth: 1,
|
|
698
|
+
nullColor: 'white'
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
tooltip: {
|
|
702
|
+
headerFormat: '',
|
|
703
|
+
pointFormat: `<div style="border-bottom: 1px solid ${ChartColors.GREY_COLORS[10]}; padding: 0 8px 7px">`
|
|
704
|
+
+ `<span style="font-size: 12px; color: ${ChartColors.GREY_COLORS[60]}">{point.tooltipHeaderLabel}</span></div>`
|
|
705
|
+
+ `<div style="font-size: 14px; color: ${ChartColors.GREY_COLORS[100]}; margin: 6px 8px 0 8px;">`
|
|
706
|
+
+ `<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.value}</b></div>`,
|
|
707
|
+
},
|
|
708
|
+
xAxis: {
|
|
709
|
+
labels: {
|
|
710
|
+
formatter: function () {
|
|
711
|
+
return this.value.toString();
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
lineWidth: 1,
|
|
715
|
+
tickWidth: 0,
|
|
716
|
+
visible: true
|
|
717
|
+
},
|
|
718
|
+
yAxis: {
|
|
719
|
+
lineWidth: 0,
|
|
720
|
+
tickInterval: 3,
|
|
721
|
+
reversed: true,
|
|
722
|
+
visible: true
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
return super.build(mergeDeep(defaultHeatmapOptions, options));
|
|
726
|
+
}
|
|
727
|
+
static configureHeatmap(categoriesX, categoriesY, series, options, labelDateFormat) {
|
|
728
|
+
super.configure(series, options, null, labelDateFormat);
|
|
729
|
+
if (categoriesX && categoriesX.length) {
|
|
730
|
+
options.xAxis.categories = categoriesX;
|
|
731
|
+
}
|
|
732
|
+
if (categoriesY && categoriesY.length) {
|
|
733
|
+
options.yAxis.categories = categoriesY;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
class ChartHeatmapComponent {
|
|
739
|
+
constructor() {
|
|
740
|
+
this.categoriesX = [];
|
|
741
|
+
this.categoriesY = [];
|
|
742
|
+
this.chartOptions = {}; // https://api.highcharts.com/highcharts/
|
|
743
|
+
this.lastWidth = 0;
|
|
744
|
+
}
|
|
745
|
+
ngOnChanges(changes) {
|
|
746
|
+
if ((changes.series && !changes.series.firstChange)) {
|
|
747
|
+
this.initChart();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
ngAfterViewChecked() {
|
|
751
|
+
if (this.chartRef && this.chartRef.nativeElement.clientWidth != this.lastWidth) {
|
|
752
|
+
this.lastWidth = this.chartRef.nativeElement.clientWidth;
|
|
753
|
+
if (this.chart) {
|
|
754
|
+
this.chart.reflow();
|
|
755
|
+
}
|
|
756
|
+
else if (this.series && this.series.length) {
|
|
757
|
+
this.initChart();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
initChart() {
|
|
762
|
+
if (this.series) {
|
|
763
|
+
const chartOptions = ChartHeatmapOptions.build(this.chartOptions);
|
|
764
|
+
ChartHeatmapOptions.configureHeatmap(this.categoriesX, this.categoriesY, this.series, chartOptions, this.labelDateFormat);
|
|
765
|
+
mapChart(this.chartRef.nativeElement, chartOptions);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
/** @nocollapse */ /** @nocollapse */ ChartHeatmapComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartHeatmapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
770
|
+
/** @nocollapse */ /** @nocollapse */ ChartHeatmapComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: ChartHeatmapComponent, selector: "ap-chart-heatmap", inputs: { categoriesX: "categoriesX", categoriesY: "categoriesY", chartOptions: "chartOptions", labelDateFormat: "labelDateFormat", series: "series" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #chart></div>\n" });
|
|
771
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartHeatmapComponent, decorators: [{
|
|
772
|
+
type: Component,
|
|
773
|
+
args: [{ selector: 'ap-chart-heatmap', template: "<div #chart></div>\n" }]
|
|
774
|
+
}], propDecorators: { chartRef: [{
|
|
775
|
+
type: ViewChild,
|
|
776
|
+
args: ['chart']
|
|
777
|
+
}], categoriesX: [{
|
|
778
|
+
type: Input
|
|
779
|
+
}], categoriesY: [{
|
|
780
|
+
type: Input
|
|
781
|
+
}], chartOptions: [{
|
|
782
|
+
type: Input
|
|
783
|
+
}], labelDateFormat: [{
|
|
784
|
+
type: Input
|
|
785
|
+
}], series: [{
|
|
786
|
+
type: Input
|
|
787
|
+
}] } });
|
|
788
|
+
|
|
789
|
+
class ChartSplineOptions extends ChartOptions {
|
|
790
|
+
static buildSpline(options, singleDayEnabled) {
|
|
791
|
+
const defaultSplineOptions = {
|
|
792
|
+
chart: {
|
|
793
|
+
type: 'spline'
|
|
794
|
+
},
|
|
795
|
+
plotOptions: {
|
|
796
|
+
series: {
|
|
797
|
+
marker: {
|
|
798
|
+
enabled: singleDayEnabled,
|
|
799
|
+
radius: singleDayEnabled ? 5 : 2,
|
|
800
|
+
symbol: 'circle'
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
xAxis: {
|
|
805
|
+
type: 'datetime'
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
return super.build(mergeDeep(defaultSplineOptions, options));
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
class ChartSplineComponent {
|
|
813
|
+
constructor() {
|
|
814
|
+
this.chartOptions = {}; // https://api.highcharts.com/highcharts/
|
|
815
|
+
this.color = ChartColor.ElectricBlue;
|
|
816
|
+
this.lastWidth = 0;
|
|
817
|
+
}
|
|
818
|
+
ngOnChanges(changes) {
|
|
819
|
+
if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
|
|
820
|
+
this.initChart();
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
ngAfterViewChecked() {
|
|
824
|
+
if (this.chartRef && this.chartRef.nativeElement.clientWidth !== this.lastWidth) {
|
|
825
|
+
this.lastWidth = this.chartRef.nativeElement.clientWidth;
|
|
826
|
+
if (this.chart) {
|
|
827
|
+
this.chart.reflow();
|
|
828
|
+
}
|
|
829
|
+
else if (this.series && this.series.length) {
|
|
830
|
+
this.initChart();
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
initChart() {
|
|
835
|
+
if (this.series) {
|
|
836
|
+
const chartOptions = ChartSplineOptions.buildSpline(this.chartOptions, this.series[0].data?.length === 1);
|
|
837
|
+
ChartSplineOptions.configure(this.series, chartOptions, this.color, this.labelDateFormat);
|
|
838
|
+
this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
/** @nocollapse */ /** @nocollapse */ ChartSplineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartSplineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
843
|
+
/** @nocollapse */ /** @nocollapse */ ChartSplineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: ChartSplineComponent, selector: "ap-chart-spline", inputs: { chartOptions: "chartOptions", color: "color", labelDateFormat: "labelDateFormat", series: "series" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #chart></div>\n" });
|
|
844
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartSplineComponent, decorators: [{
|
|
845
|
+
type: Component,
|
|
846
|
+
args: [{ selector: 'ap-chart-spline', template: "<div #chart></div>\n" }]
|
|
847
|
+
}], propDecorators: { chartRef: [{
|
|
848
|
+
type: ViewChild,
|
|
849
|
+
args: ['chart']
|
|
850
|
+
}], chartOptions: [{
|
|
851
|
+
type: Input
|
|
852
|
+
}], color: [{
|
|
853
|
+
type: Input
|
|
854
|
+
}], labelDateFormat: [{
|
|
855
|
+
type: Input
|
|
856
|
+
}], series: [{
|
|
857
|
+
type: Input
|
|
858
|
+
}] } });
|
|
859
|
+
|
|
860
|
+
class ChartPieOptions extends ChartOptions {
|
|
861
|
+
static buildPie(options, innerLabels) {
|
|
862
|
+
const defaultPieOptions = {
|
|
863
|
+
chart: {
|
|
864
|
+
type: 'pie',
|
|
865
|
+
plotBackgroundColor: null,
|
|
866
|
+
plotBorderWidth: null,
|
|
867
|
+
plotShadow: false
|
|
868
|
+
},
|
|
869
|
+
plotOptions: {
|
|
870
|
+
pie: {
|
|
871
|
+
dataLabels: {
|
|
872
|
+
distance: innerLabels ? -40 : 30,
|
|
873
|
+
useHTML: true
|
|
874
|
+
},
|
|
875
|
+
innerSize: '50%'
|
|
876
|
+
},
|
|
877
|
+
series: {
|
|
878
|
+
allowPointSelect: !innerLabels,
|
|
879
|
+
dataLabels: innerLabels ? {
|
|
880
|
+
format: '{point.percentage:.1f}%',
|
|
881
|
+
style: {
|
|
882
|
+
fontSize: '16px',
|
|
883
|
+
color: 'white',
|
|
884
|
+
textOutline: '0'
|
|
885
|
+
}
|
|
886
|
+
} : {
|
|
887
|
+
style: {
|
|
888
|
+
fontSize: '12px',
|
|
889
|
+
color: ChartColors.GREY_COLORS[60]
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
showInLegend: innerLabels,
|
|
893
|
+
states: {
|
|
894
|
+
inactive: {
|
|
895
|
+
opacity: 1
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
legend: innerLabels ? {
|
|
901
|
+
symbolHeight: 10,
|
|
902
|
+
enabled: true
|
|
903
|
+
} : {}
|
|
904
|
+
};
|
|
905
|
+
return super.build(mergeDeep(defaultPieOptions, options));
|
|
906
|
+
}
|
|
907
|
+
static configurePie(series, options, color, labelDateFormat, innerLabels) {
|
|
908
|
+
var _a, _b, _c;
|
|
909
|
+
super.configure(series, options, color, labelDateFormat);
|
|
910
|
+
if (innerLabels) {
|
|
911
|
+
options.legend.enabled = true;
|
|
912
|
+
}
|
|
913
|
+
if (series && series.length > 0 && series[0]) {
|
|
914
|
+
options.colors = ChartColors.getColors(series[0].data.length, color);
|
|
915
|
+
(_a = options.plotOptions.pie).point ?? (_a.point = {});
|
|
916
|
+
(_b = options.plotOptions.pie.point).events ?? (_b.events = {});
|
|
917
|
+
// entering a slice
|
|
918
|
+
options.plotOptions.pie.point.events.mouseOver = function () {
|
|
919
|
+
this.series.chart.series[0].points.forEach(point => {
|
|
920
|
+
if (point.index !== this.index) {
|
|
921
|
+
point.update({
|
|
922
|
+
color: ChartColors.GREY_COLORS[5]
|
|
923
|
+
}, false);
|
|
924
|
+
if (innerLabels) {
|
|
925
|
+
point.update({
|
|
926
|
+
dataLabels: {
|
|
927
|
+
style: {
|
|
928
|
+
color: ChartColors.GREY_COLORS[20]
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}, false);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
this.series.chart.redraw(false);
|
|
936
|
+
};
|
|
937
|
+
// leaving a slice
|
|
938
|
+
options.plotOptions.pie.point.events.mouseOut = function () {
|
|
939
|
+
this.series.chart.series[0].points.forEach((point, i) => {
|
|
940
|
+
if (point.index !== this.index) {
|
|
941
|
+
point.update({
|
|
942
|
+
color: options.colors[i % options.colors.length]
|
|
943
|
+
}, false);
|
|
944
|
+
if (innerLabels) {
|
|
945
|
+
point.update({
|
|
946
|
+
dataLabels: {
|
|
947
|
+
style: {
|
|
948
|
+
color: 'white'
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}, false);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
};
|
|
956
|
+
(_c = options.plotOptions.pie).events ?? (_c.events = {});
|
|
957
|
+
// leaving the whole pie
|
|
958
|
+
options.plotOptions.pie.events.mouseOut = function () {
|
|
959
|
+
this.chart.series[0].points.forEach((point, i) => {
|
|
960
|
+
point.update({
|
|
961
|
+
color: options.colors[i % options.colors.length]
|
|
962
|
+
}, false);
|
|
963
|
+
if (innerLabels) {
|
|
964
|
+
point.update({
|
|
965
|
+
dataLabels: {
|
|
966
|
+
style: {
|
|
967
|
+
color: 'white'
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}, false);
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
this.chart.redraw();
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
class ChartPieComponent {
|
|
980
|
+
constructor() {
|
|
981
|
+
this.chartOptions = {}; // https://api.highcharts.com/highcharts/
|
|
982
|
+
this.color = ChartColor.ElectricBlue;
|
|
983
|
+
this.innerLabels = false;
|
|
984
|
+
this.lastWidth = 0;
|
|
985
|
+
}
|
|
986
|
+
ngOnChanges(changes) {
|
|
987
|
+
if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
|
|
988
|
+
this.initChart();
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
ngAfterViewChecked() {
|
|
992
|
+
if (this.chartRef && this.chartRef.nativeElement.clientWidth !== this.lastWidth) {
|
|
993
|
+
this.lastWidth = this.chartRef.nativeElement.clientWidth;
|
|
994
|
+
if (this.chart) {
|
|
995
|
+
this.chart.reflow();
|
|
996
|
+
}
|
|
997
|
+
else if (this.series && this.series.length) {
|
|
998
|
+
this.initChart();
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
initChart() {
|
|
1003
|
+
if (this.series) {
|
|
1004
|
+
const chartOptions = ChartPieOptions.buildPie(this.chartOptions, this.innerLabels);
|
|
1005
|
+
ChartPieOptions.configurePie(this.series, chartOptions, this.color, this.labelDateFormat, this.innerLabels);
|
|
1006
|
+
this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
/** @nocollapse */ /** @nocollapse */ ChartPieComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartPieComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1011
|
+
/** @nocollapse */ /** @nocollapse */ ChartPieComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: ChartPieComponent, selector: "ap-chart-pie", inputs: { chartOptions: "chartOptions", color: "color", innerLabels: "innerLabels", labelDateFormat: "labelDateFormat", series: "series" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #chart></div>\n" });
|
|
1012
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartPieComponent, decorators: [{
|
|
1013
|
+
type: Component,
|
|
1014
|
+
args: [{ selector: 'ap-chart-pie', template: "<div #chart></div>\n" }]
|
|
1015
|
+
}], propDecorators: { chartRef: [{
|
|
1016
|
+
type: ViewChild,
|
|
1017
|
+
args: ['chart']
|
|
1018
|
+
}], chartOptions: [{
|
|
1019
|
+
type: Input
|
|
1020
|
+
}], color: [{
|
|
1021
|
+
type: Input
|
|
1022
|
+
}], innerLabels: [{
|
|
1023
|
+
type: Input
|
|
1024
|
+
}], labelDateFormat: [{
|
|
1025
|
+
type: Input
|
|
1026
|
+
}], series: [{
|
|
1027
|
+
type: Input
|
|
1028
|
+
}] } });
|
|
1029
|
+
|
|
1030
|
+
class AgorapulseUiChartsModule {
|
|
1031
|
+
}
|
|
1032
|
+
/** @nocollapse */ /** @nocollapse */ AgorapulseUiChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1033
|
+
/** @nocollapse */ /** @nocollapse */ AgorapulseUiChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, declarations: [ChartBarComponent,
|
|
1034
|
+
ChartColumnComponent,
|
|
1035
|
+
ChartHeatmapComponent,
|
|
1036
|
+
ChartMetricsListComponent,
|
|
1037
|
+
ChartSplineComponent,
|
|
1038
|
+
ChartPieComponent], imports: [CommonModule,
|
|
1039
|
+
HighchartsChartModule,
|
|
1040
|
+
MatListModule], exports: [ChartBarComponent,
|
|
1041
|
+
ChartColumnComponent,
|
|
1042
|
+
ChartHeatmapComponent,
|
|
1043
|
+
ChartMetricsListComponent,
|
|
1044
|
+
ChartSplineComponent,
|
|
1045
|
+
ChartPieComponent] });
|
|
1046
|
+
/** @nocollapse */ /** @nocollapse */ AgorapulseUiChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, providers: [], imports: [[
|
|
1047
|
+
CommonModule,
|
|
1048
|
+
HighchartsChartModule,
|
|
1049
|
+
MatListModule
|
|
1050
|
+
]] });
|
|
1051
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, decorators: [{
|
|
1052
|
+
type: NgModule,
|
|
1053
|
+
args: [{
|
|
1054
|
+
declarations: [
|
|
1055
|
+
ChartBarComponent,
|
|
1056
|
+
ChartColumnComponent,
|
|
1057
|
+
ChartHeatmapComponent,
|
|
1058
|
+
ChartMetricsListComponent,
|
|
1059
|
+
ChartSplineComponent,
|
|
1060
|
+
ChartPieComponent
|
|
1061
|
+
],
|
|
1062
|
+
imports: [
|
|
1063
|
+
CommonModule,
|
|
1064
|
+
HighchartsChartModule,
|
|
1065
|
+
MatListModule
|
|
1066
|
+
],
|
|
1067
|
+
exports: [
|
|
1068
|
+
ChartBarComponent,
|
|
1069
|
+
ChartColumnComponent,
|
|
1070
|
+
ChartHeatmapComponent,
|
|
1071
|
+
ChartMetricsListComponent,
|
|
1072
|
+
ChartSplineComponent,
|
|
1073
|
+
ChartPieComponent
|
|
1074
|
+
],
|
|
1075
|
+
providers: []
|
|
1076
|
+
}]
|
|
1077
|
+
}] });
|
|
1078
|
+
|
|
1079
|
+
/*
|
|
1080
|
+
* Public API Surface of ui-charts
|
|
1081
|
+
*/
|
|
1082
|
+
borderRadiusPlugin(Highcharts);
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Generated bundle index. Do not edit.
|
|
1086
|
+
*/
|
|
1087
|
+
|
|
1088
|
+
export { AgorapulseUiChartsModule, ChartBarComponent, ChartColor, ChartColors, ChartColumnComponent, ChartHeatmapComponent, ChartMetric, ChartMetricType, ChartMetricsListComponent, ChartOptions, ChartPieComponent, ChartSplineComponent, borderRadiusPlugin, mergeDeep };
|
|
1089
|
+
//# sourceMappingURL=agorapulse-ui-charts.mjs.map
|