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