@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.
Files changed (52) hide show
  1. package/agorapulse-ui-charts-13.0.0.tgz +0 -0
  2. package/agorapulse-ui-charts.d.ts +1 -0
  3. package/{esm2015/agorapulse-ui-charts.js → esm2020/agorapulse-ui-charts.mjs} +0 -0
  4. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  5. package/esm2020/src/lib/agorapulse-ui-charts.module.mjs +60 -0
  6. package/esm2020/src/lib/chart-bar/chart-bar-options.model.mjs +80 -0
  7. package/esm2020/src/lib/chart-bar/chart-bar.component.mjs +58 -0
  8. package/{esm2015/src/lib/chart-colors.js → esm2020/src/lib/chart-colors.mjs} +3 -2
  9. package/esm2020/src/lib/chart-column/chart-column-options.model.mjs +104 -0
  10. package/esm2020/src/lib/chart-column/chart-column.component.mjs +59 -0
  11. package/{esm2015/src/lib/chart-heatmap/chart-heatmap-options.model.js → esm2020/src/lib/chart-heatmap/chart-heatmap-options.model.mjs} +0 -0
  12. package/esm2020/src/lib/chart-heatmap/chart-heatmap.component.mjs +55 -0
  13. package/{esm2015/src/lib/chart-metric.js → esm2020/src/lib/chart-metric.mjs} +0 -0
  14. package/esm2020/src/lib/chart-metrics-list/chart-metrics-list.component.mjs +23 -0
  15. package/{esm2015/src/lib/chart-options.js → esm2020/src/lib/chart-options.mjs} +0 -0
  16. package/esm2020/src/lib/chart-pie/chart-pie-options.model.mjs +121 -0
  17. package/esm2020/src/lib/chart-pie/chart-pie.component.mjs +56 -0
  18. package/esm2020/src/lib/chart-spline/chart-spline-options.model.mjs +24 -0
  19. package/esm2020/src/lib/chart-spline/chart-spline.component.mjs +53 -0
  20. package/{esm2015/src/lib/highchart-series.model.js → esm2020/src/lib/highchart-series.model.mjs} +0 -0
  21. package/{esm2015/src/lib/highcharts-border-radius-plugin.js → esm2020/src/lib/highcharts-border-radius-plugin.mjs} +0 -0
  22. package/fesm2015/agorapulse-ui-charts.mjs +1088 -0
  23. package/fesm2015/agorapulse-ui-charts.mjs.map +1 -0
  24. package/fesm2020/agorapulse-ui-charts.mjs +1089 -0
  25. package/fesm2020/agorapulse-ui-charts.mjs.map +1 -0
  26. package/package.json +26 -13
  27. package/src/lib/agorapulse-ui-charts.module.d.ts +13 -0
  28. package/src/lib/chart-bar/chart-bar.component.d.ts +4 -1
  29. package/src/lib/chart-colors.d.ts +1 -0
  30. package/src/lib/chart-column/chart-column.component.d.ts +4 -1
  31. package/src/lib/chart-heatmap/chart-heatmap.component.d.ts +3 -0
  32. package/src/lib/chart-metrics-list/chart-metrics-list.component.d.ts +3 -0
  33. package/src/lib/chart-pie/chart-pie.component.d.ts +3 -0
  34. package/src/lib/chart-spline/chart-spline-options.model.d.ts +1 -1
  35. package/src/lib/chart-spline/chart-spline.component.d.ts +3 -0
  36. package/agorapulse-ui-charts-2.2.16.tgz +0 -0
  37. package/agorapulse-ui-charts.metadata.json +0 -1
  38. package/bundles/agorapulse-ui-charts.umd.js +0 -1378
  39. package/bundles/agorapulse-ui-charts.umd.js.map +0 -1
  40. package/esm2015/src/lib/agorapulse-ui-charts.module.js +0 -39
  41. package/esm2015/src/lib/chart-bar/chart-bar-options.model.js +0 -77
  42. package/esm2015/src/lib/chart-bar/chart-bar.component.js +0 -52
  43. package/esm2015/src/lib/chart-column/chart-column-options.model.js +0 -103
  44. package/esm2015/src/lib/chart-column/chart-column.component.js +0 -54
  45. package/esm2015/src/lib/chart-heatmap/chart-heatmap.component.js +0 -50
  46. package/esm2015/src/lib/chart-metrics-list/chart-metrics-list.component.js +0 -21
  47. package/esm2015/src/lib/chart-pie/chart-pie-options.model.js +0 -55
  48. package/esm2015/src/lib/chart-pie/chart-pie.component.js +0 -51
  49. package/esm2015/src/lib/chart-spline/chart-spline-options.model.js +0 -24
  50. package/esm2015/src/lib/chart-spline/chart-spline.component.js +0 -54
  51. package/fesm2015/agorapulse-ui-charts.js +0 -981
  52. package/fesm2015/agorapulse-ui-charts.js.map +0 -1
@@ -0,0 +1,1088 @@
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 Object.assign(Object.assign({}, point), { y: -Math.abs(point.y) });
419
+ }
420
+ else if (!isNaN(point)) {
421
+ return -Math.abs(point);
422
+ }
423
+ return point;
424
+ });
425
+ options.plotOptions.series.stacking = 'normal';
426
+ options.yAxis.labels.formatter = function () {
427
+ return Math.abs(+this.value) + '%';
428
+ };
429
+ options.tooltip.pointFormatter = function () {
430
+ 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>`;
431
+ };
432
+ }
433
+ }
434
+ }
435
+
436
+ class ChartBarComponent {
437
+ constructor() {
438
+ this.categories = [];
439
+ this.chartOptions = {}; // https://api.highcharts.com/highcharts/
440
+ this.color = ChartColor.ElectricBlue;
441
+ this.lastWidth = 0;
442
+ }
443
+ ngOnChanges(changes) {
444
+ if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
445
+ this.initChart();
446
+ }
447
+ }
448
+ ngAfterViewChecked() {
449
+ if (this.chartRef && this.chartRef.nativeElement.clientWidth != this.lastWidth) {
450
+ this.lastWidth = this.chartRef.nativeElement.clientWidth;
451
+ if (this.chart) {
452
+ this.chart.reflow();
453
+ }
454
+ else if (this.series && this.series.length) {
455
+ this.initChart();
456
+ }
457
+ }
458
+ }
459
+ initChart() {
460
+ if (this.series) {
461
+ const chartOptions = ChartBarOptions.build(this.chartOptions);
462
+ ChartBarOptions.configureBar(this.series, this.categories, chartOptions, this.opposite, this.color, this.labelDateFormat);
463
+ this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
464
+ }
465
+ }
466
+ }
467
+ /** @nocollapse */ /** @nocollapse */ ChartBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
468
+ /** @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" });
469
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartBarComponent, decorators: [{
470
+ type: Component,
471
+ args: [{ selector: 'ap-chart-bar', template: "<div #chart></div>\n" }]
472
+ }], propDecorators: { chartRef: [{
473
+ type: ViewChild,
474
+ args: ['chart']
475
+ }], categories: [{
476
+ type: Input
477
+ }], chartOptions: [{
478
+ type: Input
479
+ }], color: [{
480
+ type: Input
481
+ }], labelDateFormat: [{
482
+ type: Input
483
+ }], opposite: [{
484
+ type: Input
485
+ }], series: [{
486
+ type: Input
487
+ }] } });
488
+
489
+ class ChartColumnOptions extends ChartOptions {
490
+ static buildColumn(options, simple) {
491
+ const defaultColumnOptions = {
492
+ chart: {
493
+ type: 'column'
494
+ },
495
+ legend: {
496
+ symbolHeight: 10
497
+ },
498
+ plotOptions: {
499
+ column: {
500
+ stacking: 'normal',
501
+ borderWidth: 0,
502
+ maxPointWidth: 20,
503
+ events: {
504
+ hide() {
505
+ ChartColumnOptions.redrawWithRoundedColumns(this.chart);
506
+ },
507
+ show() {
508
+ ChartColumnOptions.redrawWithRoundedColumns(this.chart);
509
+ }
510
+ }
511
+ }
512
+ },
513
+ xAxis: {
514
+ type: 'datetime'
515
+ }
516
+ };
517
+ const simpleColumnOptions = {
518
+ chart: {
519
+ type: 'column',
520
+ height: '80px'
521
+ },
522
+ credits: {
523
+ enabled: false
524
+ },
525
+ plotOptions: {
526
+ column: {
527
+ events: {
528
+ hide() {
529
+ ChartColumnOptions.redrawWithRoundedColumns(this.chart);
530
+ },
531
+ show() {
532
+ ChartColumnOptions.redrawWithRoundedColumns(this.chart);
533
+ }
534
+ },
535
+ }
536
+ },
537
+ xAxis: {
538
+ type: 'datetime',
539
+ crosshair: true,
540
+ labels: {
541
+ enabled: false,
542
+ formatter() {
543
+ return dateFormat('%m/%d', +this.value);
544
+ }
545
+ },
546
+ lineWidth: 0,
547
+ tickWidth: 0,
548
+ gridLineWidth: 0
549
+ },
550
+ yAxis: {
551
+ min: 0,
552
+ labels: {
553
+ enabled: false
554
+ },
555
+ gridLineWidth: 0
556
+ }
557
+ };
558
+ return super.build(mergeDeep(simple ? simpleColumnOptions : defaultColumnOptions, options));
559
+ }
560
+ static redrawWithRoundedColumns(chart) {
561
+ chart.series.map((serie, serieIndex, arr) => {
562
+ ChartColumnOptions.roundSerie(arr, serie.options, serieIndex);
563
+ });
564
+ chart.redraw(true);
565
+ }
566
+ static roundSerie(series, serie, serieIndex) {
567
+ const roundedOptionMap = [];
568
+ let borderRadius = 0;
569
+ if (serie.data) {
570
+ serie.data.forEach((point, columnIndex) => {
571
+ // Check if all previous stacked data at the same abscissa (located higher on the graph) are missing or have a value of 0
572
+ // if so, it means that this point is the visual top of the column, so we should round it
573
+ const roundedColumnEnabled = series.slice(0, serieIndex)
574
+ .every(otherSerie => {
575
+ if (otherSerie.visible === false) {
576
+ return true;
577
+ }
578
+ const pointAtSameAbscissa = otherSerie.options
579
+ .data.find(otherPoint => otherPoint[0] === point[0]);
580
+ return !pointAtSameAbscissa || pointAtSameAbscissa[1] === 0;
581
+ });
582
+ borderRadius = roundedColumnEnabled ? 100 : 0;
583
+ roundedOptionMap[columnIndex] = borderRadius;
584
+ });
585
+ serie.borderRadiusTopLeft = roundedOptionMap;
586
+ serie.borderRadiusTopRight = roundedOptionMap;
587
+ }
588
+ }
589
+ }
590
+
591
+ class ChartColumnComponent {
592
+ constructor() {
593
+ this.chartOptions = {}; // https://api.highcharts.com/highcharts/
594
+ this.color = ChartColor.ElectricBlue;
595
+ this.simple = false;
596
+ this.lastWidth = 0;
597
+ }
598
+ ngOnChanges(changes) {
599
+ if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
600
+ this.initChart();
601
+ }
602
+ }
603
+ ngAfterViewChecked() {
604
+ if (this.chartRef && this.chartRef.nativeElement.clientWidth != this.lastWidth) {
605
+ this.lastWidth = this.chartRef.nativeElement.clientWidth;
606
+ if (this.chart) {
607
+ this.chart.reflow();
608
+ }
609
+ else if (this.series && this.series.length) {
610
+ this.initChart();
611
+ }
612
+ }
613
+ }
614
+ initChart() {
615
+ if (this.series) {
616
+ const chartOptions = ChartColumnOptions.buildColumn(this.chartOptions, this.simple);
617
+ ChartColumnOptions.configure(this.series, chartOptions, this.color, this.labelDateFormat);
618
+ this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
619
+ if (this.chart) {
620
+ ChartColumnOptions.redrawWithRoundedColumns(this.chart);
621
+ }
622
+ }
623
+ }
624
+ }
625
+ /** @nocollapse */ /** @nocollapse */ ChartColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
626
+ /** @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" });
627
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartColumnComponent, decorators: [{
628
+ type: Component,
629
+ args: [{ selector: 'ap-chart-column', template: "<div #chart></div>\n" }]
630
+ }], propDecorators: { chartRef: [{
631
+ type: ViewChild,
632
+ args: ['chart']
633
+ }], chartOptions: [{
634
+ type: Input
635
+ }], color: [{
636
+ type: Input
637
+ }], labelDateFormat: [{
638
+ type: Input
639
+ }], series: [{
640
+ type: Input
641
+ }], simple: [{
642
+ type: Input
643
+ }] } });
644
+
645
+ var ChartMetricType;
646
+ (function (ChartMetricType) {
647
+ ChartMetricType[ChartMetricType["default"] = 0] = "default";
648
+ ChartMetricType[ChartMetricType["total"] = 1] = "total";
649
+ })(ChartMetricType || (ChartMetricType = {}));
650
+ class ChartMetric {
651
+ }
652
+
653
+ class ChartMetricsListComponent {
654
+ constructor() {
655
+ this.ChartMetricType = ChartMetricType;
656
+ this.digitsInfo = '1.0-1';
657
+ }
658
+ }
659
+ /** @nocollapse */ /** @nocollapse */ ChartMetricsListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartMetricsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
660
+ /** @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 });
661
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartMetricsListComponent, decorators: [{
662
+ type: Component,
663
+ 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"] }]
664
+ }], propDecorators: { metrics: [{
665
+ type: Input
666
+ }], locale: [{
667
+ type: Input
668
+ }] } });
669
+
670
+ class ChartHeatmapOptions extends ChartOptions {
671
+ static build(options) {
672
+ const defaultHeatmapOptions = {
673
+ chart: {
674
+ type: 'heatmap',
675
+ height: 600
676
+ },
677
+ colorAxis: {
678
+ allowDecimals: false,
679
+ gridLineWidth: 2,
680
+ gridLineColor: 'white',
681
+ min: 0,
682
+ labels: {
683
+ style: {
684
+ fontSize: '12px'
685
+ }
686
+ }
687
+ },
688
+ legend: {
689
+ enabled: false
690
+ },
691
+ plotOptions: {
692
+ heatmap: {
693
+ borderColor: ChartColors.GREY_COLORS[10],
694
+ borderWidth: 1,
695
+ nullColor: 'white'
696
+ }
697
+ },
698
+ tooltip: {
699
+ headerFormat: '',
700
+ pointFormat: `<div style="border-bottom: 1px solid ${ChartColors.GREY_COLORS[10]}; padding: 0 8px 7px">`
701
+ + `<span style="font-size: 12px; color: ${ChartColors.GREY_COLORS[60]}">{point.tooltipHeaderLabel}</span></div>`
702
+ + `<div style="font-size: 14px; color: ${ChartColors.GREY_COLORS[100]}; margin: 6px 8px 0 8px;">`
703
+ + `<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.value}</b></div>`,
704
+ },
705
+ xAxis: {
706
+ labels: {
707
+ formatter: function () {
708
+ return this.value.toString();
709
+ }
710
+ },
711
+ lineWidth: 1,
712
+ tickWidth: 0,
713
+ visible: true
714
+ },
715
+ yAxis: {
716
+ lineWidth: 0,
717
+ tickInterval: 3,
718
+ reversed: true,
719
+ visible: true
720
+ }
721
+ };
722
+ return super.build(mergeDeep(defaultHeatmapOptions, options));
723
+ }
724
+ static configureHeatmap(categoriesX, categoriesY, series, options, labelDateFormat) {
725
+ super.configure(series, options, null, labelDateFormat);
726
+ if (categoriesX && categoriesX.length) {
727
+ options.xAxis.categories = categoriesX;
728
+ }
729
+ if (categoriesY && categoriesY.length) {
730
+ options.yAxis.categories = categoriesY;
731
+ }
732
+ }
733
+ }
734
+
735
+ class ChartHeatmapComponent {
736
+ constructor() {
737
+ this.categoriesX = [];
738
+ this.categoriesY = [];
739
+ this.chartOptions = {}; // https://api.highcharts.com/highcharts/
740
+ this.lastWidth = 0;
741
+ }
742
+ ngOnChanges(changes) {
743
+ if ((changes.series && !changes.series.firstChange)) {
744
+ this.initChart();
745
+ }
746
+ }
747
+ ngAfterViewChecked() {
748
+ if (this.chartRef && this.chartRef.nativeElement.clientWidth != this.lastWidth) {
749
+ this.lastWidth = this.chartRef.nativeElement.clientWidth;
750
+ if (this.chart) {
751
+ this.chart.reflow();
752
+ }
753
+ else if (this.series && this.series.length) {
754
+ this.initChart();
755
+ }
756
+ }
757
+ }
758
+ initChart() {
759
+ if (this.series) {
760
+ const chartOptions = ChartHeatmapOptions.build(this.chartOptions);
761
+ ChartHeatmapOptions.configureHeatmap(this.categoriesX, this.categoriesY, this.series, chartOptions, this.labelDateFormat);
762
+ mapChart(this.chartRef.nativeElement, chartOptions);
763
+ }
764
+ }
765
+ }
766
+ /** @nocollapse */ /** @nocollapse */ ChartHeatmapComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartHeatmapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
767
+ /** @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" });
768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartHeatmapComponent, decorators: [{
769
+ type: Component,
770
+ args: [{ selector: 'ap-chart-heatmap', template: "<div #chart></div>\n" }]
771
+ }], propDecorators: { chartRef: [{
772
+ type: ViewChild,
773
+ args: ['chart']
774
+ }], categoriesX: [{
775
+ type: Input
776
+ }], categoriesY: [{
777
+ type: Input
778
+ }], chartOptions: [{
779
+ type: Input
780
+ }], labelDateFormat: [{
781
+ type: Input
782
+ }], series: [{
783
+ type: Input
784
+ }] } });
785
+
786
+ class ChartSplineOptions extends ChartOptions {
787
+ static buildSpline(options, singleDayEnabled) {
788
+ const defaultSplineOptions = {
789
+ chart: {
790
+ type: 'spline'
791
+ },
792
+ plotOptions: {
793
+ series: {
794
+ marker: {
795
+ enabled: singleDayEnabled,
796
+ radius: singleDayEnabled ? 5 : 2,
797
+ symbol: 'circle'
798
+ }
799
+ }
800
+ },
801
+ xAxis: {
802
+ type: 'datetime'
803
+ }
804
+ };
805
+ return super.build(mergeDeep(defaultSplineOptions, options));
806
+ }
807
+ }
808
+
809
+ class ChartSplineComponent {
810
+ constructor() {
811
+ this.chartOptions = {}; // https://api.highcharts.com/highcharts/
812
+ this.color = ChartColor.ElectricBlue;
813
+ this.lastWidth = 0;
814
+ }
815
+ ngOnChanges(changes) {
816
+ if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
817
+ this.initChart();
818
+ }
819
+ }
820
+ ngAfterViewChecked() {
821
+ if (this.chartRef && this.chartRef.nativeElement.clientWidth !== this.lastWidth) {
822
+ this.lastWidth = this.chartRef.nativeElement.clientWidth;
823
+ if (this.chart) {
824
+ this.chart.reflow();
825
+ }
826
+ else if (this.series && this.series.length) {
827
+ this.initChart();
828
+ }
829
+ }
830
+ }
831
+ initChart() {
832
+ var _a;
833
+ if (this.series) {
834
+ const chartOptions = ChartSplineOptions.buildSpline(this.chartOptions, ((_a = this.series[0].data) === null || _a === void 0 ? void 0 : _a.length) === 1);
835
+ ChartSplineOptions.configure(this.series, chartOptions, this.color, this.labelDateFormat);
836
+ this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
837
+ }
838
+ }
839
+ }
840
+ /** @nocollapse */ /** @nocollapse */ ChartSplineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartSplineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
841
+ /** @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" });
842
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartSplineComponent, decorators: [{
843
+ type: Component,
844
+ args: [{ selector: 'ap-chart-spline', template: "<div #chart></div>\n" }]
845
+ }], propDecorators: { chartRef: [{
846
+ type: ViewChild,
847
+ args: ['chart']
848
+ }], chartOptions: [{
849
+ type: Input
850
+ }], color: [{
851
+ type: Input
852
+ }], labelDateFormat: [{
853
+ type: Input
854
+ }], series: [{
855
+ type: Input
856
+ }] } });
857
+
858
+ class ChartPieOptions extends ChartOptions {
859
+ static buildPie(options, innerLabels) {
860
+ const defaultPieOptions = {
861
+ chart: {
862
+ type: 'pie',
863
+ plotBackgroundColor: null,
864
+ plotBorderWidth: null,
865
+ plotShadow: false
866
+ },
867
+ plotOptions: {
868
+ pie: {
869
+ dataLabels: {
870
+ distance: innerLabels ? -40 : 30,
871
+ useHTML: true
872
+ },
873
+ innerSize: '50%'
874
+ },
875
+ series: {
876
+ allowPointSelect: !innerLabels,
877
+ dataLabels: innerLabels ? {
878
+ format: '{point.percentage:.1f}%',
879
+ style: {
880
+ fontSize: '16px',
881
+ color: 'white',
882
+ textOutline: '0'
883
+ }
884
+ } : {
885
+ style: {
886
+ fontSize: '12px',
887
+ color: ChartColors.GREY_COLORS[60]
888
+ }
889
+ },
890
+ showInLegend: innerLabels,
891
+ states: {
892
+ inactive: {
893
+ opacity: 1
894
+ }
895
+ }
896
+ }
897
+ },
898
+ legend: innerLabels ? {
899
+ symbolHeight: 10,
900
+ enabled: true
901
+ } : {}
902
+ };
903
+ return super.build(mergeDeep(defaultPieOptions, options));
904
+ }
905
+ static configurePie(series, options, color, labelDateFormat, innerLabels) {
906
+ var _d, _e, _f;
907
+ var _a, _b, _c;
908
+ super.configure(series, options, color, labelDateFormat);
909
+ if (innerLabels) {
910
+ options.legend.enabled = true;
911
+ }
912
+ if (series && series.length > 0 && series[0]) {
913
+ options.colors = ChartColors.getColors(series[0].data.length, color);
914
+ (_d = (_a = options.plotOptions.pie).point) !== null && _d !== void 0 ? _d : (_a.point = {});
915
+ (_e = (_b = options.plotOptions.pie.point).events) !== null && _e !== void 0 ? _e : (_b.events = {});
916
+ // entering a slice
917
+ options.plotOptions.pie.point.events.mouseOver = function () {
918
+ this.series.chart.series[0].points.forEach(point => {
919
+ if (point.index !== this.index) {
920
+ point.update({
921
+ color: ChartColors.GREY_COLORS[5]
922
+ }, false);
923
+ if (innerLabels) {
924
+ point.update({
925
+ dataLabels: {
926
+ style: {
927
+ color: ChartColors.GREY_COLORS[20]
928
+ }
929
+ }
930
+ }, false);
931
+ }
932
+ }
933
+ });
934
+ this.series.chart.redraw(false);
935
+ };
936
+ // leaving a slice
937
+ options.plotOptions.pie.point.events.mouseOut = function () {
938
+ this.series.chart.series[0].points.forEach((point, i) => {
939
+ if (point.index !== this.index) {
940
+ point.update({
941
+ color: options.colors[i % options.colors.length]
942
+ }, false);
943
+ if (innerLabels) {
944
+ point.update({
945
+ dataLabels: {
946
+ style: {
947
+ color: 'white'
948
+ }
949
+ }
950
+ }, false);
951
+ }
952
+ }
953
+ });
954
+ };
955
+ (_f = (_c = options.plotOptions.pie).events) !== null && _f !== void 0 ? _f : (_c.events = {});
956
+ // leaving the whole pie
957
+ options.plotOptions.pie.events.mouseOut = function () {
958
+ this.chart.series[0].points.forEach((point, i) => {
959
+ point.update({
960
+ color: options.colors[i % options.colors.length]
961
+ }, false);
962
+ if (innerLabels) {
963
+ point.update({
964
+ dataLabels: {
965
+ style: {
966
+ color: 'white'
967
+ }
968
+ }
969
+ }, false);
970
+ }
971
+ });
972
+ this.chart.redraw();
973
+ };
974
+ }
975
+ }
976
+ }
977
+
978
+ class ChartPieComponent {
979
+ constructor() {
980
+ this.chartOptions = {}; // https://api.highcharts.com/highcharts/
981
+ this.color = ChartColor.ElectricBlue;
982
+ this.innerLabels = false;
983
+ this.lastWidth = 0;
984
+ }
985
+ ngOnChanges(changes) {
986
+ if ((changes.series && !changes.series.firstChange) || (changes.color && !changes.color.firstChange)) {
987
+ this.initChart();
988
+ }
989
+ }
990
+ ngAfterViewChecked() {
991
+ if (this.chartRef && this.chartRef.nativeElement.clientWidth !== this.lastWidth) {
992
+ this.lastWidth = this.chartRef.nativeElement.clientWidth;
993
+ if (this.chart) {
994
+ this.chart.reflow();
995
+ }
996
+ else if (this.series && this.series.length) {
997
+ this.initChart();
998
+ }
999
+ }
1000
+ }
1001
+ initChart() {
1002
+ if (this.series) {
1003
+ const chartOptions = ChartPieOptions.buildPie(this.chartOptions, this.innerLabels);
1004
+ ChartPieOptions.configurePie(this.series, chartOptions, this.color, this.labelDateFormat, this.innerLabels);
1005
+ this.chart = new Chart(this.chartRef.nativeElement, chartOptions);
1006
+ }
1007
+ }
1008
+ }
1009
+ /** @nocollapse */ /** @nocollapse */ ChartPieComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartPieComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1010
+ /** @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" });
1011
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ChartPieComponent, decorators: [{
1012
+ type: Component,
1013
+ args: [{ selector: 'ap-chart-pie', template: "<div #chart></div>\n" }]
1014
+ }], propDecorators: { chartRef: [{
1015
+ type: ViewChild,
1016
+ args: ['chart']
1017
+ }], chartOptions: [{
1018
+ type: Input
1019
+ }], color: [{
1020
+ type: Input
1021
+ }], innerLabels: [{
1022
+ type: Input
1023
+ }], labelDateFormat: [{
1024
+ type: Input
1025
+ }], series: [{
1026
+ type: Input
1027
+ }] } });
1028
+
1029
+ class AgorapulseUiChartsModule {
1030
+ }
1031
+ /** @nocollapse */ /** @nocollapse */ AgorapulseUiChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1032
+ /** @nocollapse */ /** @nocollapse */ AgorapulseUiChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, declarations: [ChartBarComponent,
1033
+ ChartColumnComponent,
1034
+ ChartHeatmapComponent,
1035
+ ChartMetricsListComponent,
1036
+ ChartSplineComponent,
1037
+ ChartPieComponent], imports: [CommonModule,
1038
+ HighchartsChartModule,
1039
+ MatListModule], exports: [ChartBarComponent,
1040
+ ChartColumnComponent,
1041
+ ChartHeatmapComponent,
1042
+ ChartMetricsListComponent,
1043
+ ChartSplineComponent,
1044
+ ChartPieComponent] });
1045
+ /** @nocollapse */ /** @nocollapse */ AgorapulseUiChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, providers: [], imports: [[
1046
+ CommonModule,
1047
+ HighchartsChartModule,
1048
+ MatListModule
1049
+ ]] });
1050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AgorapulseUiChartsModule, decorators: [{
1051
+ type: NgModule,
1052
+ args: [{
1053
+ declarations: [
1054
+ ChartBarComponent,
1055
+ ChartColumnComponent,
1056
+ ChartHeatmapComponent,
1057
+ ChartMetricsListComponent,
1058
+ ChartSplineComponent,
1059
+ ChartPieComponent
1060
+ ],
1061
+ imports: [
1062
+ CommonModule,
1063
+ HighchartsChartModule,
1064
+ MatListModule
1065
+ ],
1066
+ exports: [
1067
+ ChartBarComponent,
1068
+ ChartColumnComponent,
1069
+ ChartHeatmapComponent,
1070
+ ChartMetricsListComponent,
1071
+ ChartSplineComponent,
1072
+ ChartPieComponent
1073
+ ],
1074
+ providers: []
1075
+ }]
1076
+ }] });
1077
+
1078
+ /*
1079
+ * Public API Surface of ui-charts
1080
+ */
1081
+ borderRadiusPlugin(Highcharts);
1082
+
1083
+ /**
1084
+ * Generated bundle index. Do not edit.
1085
+ */
1086
+
1087
+ export { AgorapulseUiChartsModule, ChartBarComponent, ChartColor, ChartColors, ChartColumnComponent, ChartHeatmapComponent, ChartMetric, ChartMetricType, ChartMetricsListComponent, ChartOptions, ChartPieComponent, ChartSplineComponent, borderRadiusPlugin, mergeDeep };
1088
+ //# sourceMappingURL=agorapulse-ui-charts.mjs.map