@esfaenza/es-charts 12.2.14 → 13.1.2

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 (96) hide show
  1. package/esfaenza-es-charts.d.ts +1 -6
  2. package/esm2020/esfaenza-es-charts.mjs +5 -0
  3. package/esm2020/lib/adapters/classes/BaseAdapter.mjs +50 -0
  4. package/{esm2015/lib/adapters/classes/IBaseAdapter.js → esm2020/lib/adapters/classes/IBaseAdapter.mjs} +0 -0
  5. package/{esm2015/lib/adapters/index.js → esm2020/lib/adapters/index.mjs} +0 -0
  6. package/esm2020/lib/components/base/base-chart.component.mjs +325 -0
  7. package/esm2020/lib/components/chart-pager/chart-pager.component.mjs +89 -0
  8. package/{esm2015/lib/components/index.js → esm2020/lib/components/index.mjs} +0 -0
  9. package/esm2020/lib/components/specializations/es-area-chart.component.mjs +78 -0
  10. package/esm2020/lib/components/specializations/es-chart.component.mjs +111 -0
  11. package/esm2020/lib/components/specializations/es-line-chart.component.mjs +110 -0
  12. package/esm2020/lib/components/specializations/es-pie-chart.component.mjs +99 -0
  13. package/esm2020/lib/components/specializations/es-vertical-2d-chart.component.mjs +96 -0
  14. package/esm2020/lib/components/specializations/es-vertical-chart.component.mjs +93 -0
  15. package/esm2020/lib/components/specializations/es-vertical-stacked-chart.component.mjs +93 -0
  16. package/esm2020/lib/es-charts.module.mjs +61 -0
  17. package/{esm2015/lib/models/EsChaartsModuleConfig.js → esm2020/lib/models/EsChaartsModuleConfig.mjs} +0 -0
  18. package/esm2020/lib/models/core/classes/ChartDispatcher.mjs +91 -0
  19. package/{esm2015/lib/models/core/classes/ChartLoader.js → esm2020/lib/models/core/classes/ChartLoader.mjs} +0 -0
  20. package/{esm2015/lib/models/core/classes/ChartThemes.js → esm2020/lib/models/core/classes/ChartThemes.mjs} +0 -0
  21. package/{esm2015/lib/models/core/index.js → esm2020/lib/models/core/index.mjs} +0 -0
  22. package/{esm2015/lib/models/data/classes/AreaChartData.js → esm2020/lib/models/data/classes/AreaChartData.mjs} +0 -0
  23. package/{esm2015/lib/models/data/classes/LineChartData.js → esm2020/lib/models/data/classes/LineChartData.mjs} +0 -0
  24. package/{esm2015/lib/models/data/classes/PagedChartData.js → esm2020/lib/models/data/classes/PagedChartData.mjs} +0 -0
  25. package/{esm2015/lib/models/data/classes/PieChartData.js → esm2020/lib/models/data/classes/PieChartData.mjs} +0 -0
  26. package/{esm2015/lib/models/data/classes/Vertical2DChartData.js → esm2020/lib/models/data/classes/Vertical2DChartData.mjs} +0 -0
  27. package/{esm2015/lib/models/data/classes/VerticalChartData.js → esm2020/lib/models/data/classes/VerticalChartData.mjs} +0 -0
  28. package/{esm2015/lib/models/data/classes/VerticalStackedChartData.js → esm2020/lib/models/data/classes/VerticalStackedChartData.mjs} +0 -0
  29. package/{esm2015/lib/models/data/classes/base/DateValue.js → esm2020/lib/models/data/classes/base/DateValue.mjs} +0 -0
  30. package/{esm2015/lib/models/data/classes/base/KeyValue.js → esm2020/lib/models/data/classes/base/KeyValue.mjs} +0 -0
  31. package/{esm2015/lib/models/data/classes/base/KeyValueColor.js → esm2020/lib/models/data/classes/base/KeyValueColor.mjs} +0 -0
  32. package/{esm2015/lib/models/data/classes/base/Limit.js → esm2020/lib/models/data/classes/base/Limit.mjs} +0 -0
  33. package/{esm2015/lib/models/data/classes/base/LineSerie.js → esm2020/lib/models/data/classes/base/LineSerie.mjs} +0 -0
  34. package/{esm2015/lib/models/data/index.js → esm2020/lib/models/data/index.mjs} +0 -0
  35. package/{esm2015/lib/models/settings/classes/AreaChartSettings.js → esm2020/lib/models/settings/classes/AreaChartSettings.mjs} +0 -0
  36. package/{esm2015/lib/models/settings/classes/LineChartSettings.js → esm2020/lib/models/settings/classes/LineChartSettings.mjs} +0 -0
  37. package/{esm2015/lib/models/settings/classes/PieChartSettings.js → esm2020/lib/models/settings/classes/PieChartSettings.mjs} +0 -0
  38. package/{esm2015/lib/models/settings/classes/Vertical2DChartSettings.js → esm2020/lib/models/settings/classes/Vertical2DChartSettings.mjs} +0 -0
  39. package/{esm2015/lib/models/settings/classes/VerticalChartSettings.js → esm2020/lib/models/settings/classes/VerticalChartSettings.mjs} +0 -0
  40. package/{esm2015/lib/models/settings/classes/VerticalStackedChartSettings.js → esm2020/lib/models/settings/classes/VerticalStackedChartSettings.mjs} +0 -0
  41. package/{esm2015/lib/models/settings/classes/base/BaseInterval.js → esm2020/lib/models/settings/classes/base/BaseInterval.mjs} +0 -0
  42. package/{esm2015/lib/models/settings/classes/base/BaseSettings.js → esm2020/lib/models/settings/classes/base/BaseSettings.mjs} +0 -0
  43. package/{esm2015/lib/models/settings/classes/base/LegendPad.js → esm2020/lib/models/settings/classes/base/LegendPad.mjs} +0 -0
  44. package/{esm2015/lib/models/settings/index.js → esm2020/lib/models/settings/index.mjs} +0 -0
  45. package/esm2020/lib/services/classes/AreaChartService.mjs +134 -0
  46. package/esm2020/lib/services/classes/LineChartService.mjs +324 -0
  47. package/esm2020/lib/services/classes/PieChartService.mjs +111 -0
  48. package/esm2020/lib/services/classes/Vertical2DChartService.mjs +160 -0
  49. package/esm2020/lib/services/classes/VerticalChartService.mjs +103 -0
  50. package/esm2020/lib/services/classes/VerticalStackedChartService.mjs +124 -0
  51. package/{esm2015/lib/services/classes/base/IBaseService.js → esm2020/lib/services/classes/base/IBaseService.mjs} +0 -0
  52. package/{esm2015/lib/services/index.js → esm2020/lib/services/index.mjs} +0 -0
  53. package/{esm2015/lib/tokens.js → esm2020/lib/tokens.mjs} +0 -0
  54. package/esm2020/public-api.mjs +37 -0
  55. package/fesm2015/{esfaenza-es-charts.js → esfaenza-es-charts.mjs} +452 -352
  56. package/fesm2015/esfaenza-es-charts.mjs.map +1 -0
  57. package/fesm2020/esfaenza-es-charts.mjs +2701 -0
  58. package/fesm2020/esfaenza-es-charts.mjs.map +1 -0
  59. package/lib/adapters/classes/BaseAdapter.d.ts +3 -0
  60. package/lib/components/base/base-chart.component.d.ts +3 -0
  61. package/lib/components/chart-pager/chart-pager.component.d.ts +3 -0
  62. package/lib/components/specializations/es-area-chart.component.d.ts +3 -0
  63. package/lib/components/specializations/es-chart.component.d.ts +3 -0
  64. package/lib/components/specializations/es-line-chart.component.d.ts +3 -0
  65. package/lib/components/specializations/es-pie-chart.component.d.ts +3 -0
  66. package/lib/components/specializations/es-vertical-2d-chart.component.d.ts +3 -0
  67. package/lib/components/specializations/es-vertical-chart.component.d.ts +3 -0
  68. package/lib/components/specializations/es-vertical-stacked-chart.component.d.ts +3 -0
  69. package/lib/es-charts.module.d.ts +13 -0
  70. package/lib/models/core/classes/ChartDispatcher.d.ts +3 -0
  71. package/package.json +22 -10
  72. package/public-api.d.ts +1 -0
  73. package/bundles/esfaenza-es-charts.umd.js +0 -3212
  74. package/bundles/esfaenza-es-charts.umd.js.map +0 -1
  75. package/esfaenza-es-charts.metadata.json +0 -1
  76. package/esm2015/esfaenza-es-charts.js +0 -11
  77. package/esm2015/lib/adapters/classes/BaseAdapter.js +0 -47
  78. package/esm2015/lib/components/base/base-chart.component.js +0 -311
  79. package/esm2015/lib/components/chart-pager/chart-pager.component.js +0 -84
  80. package/esm2015/lib/components/specializations/es-area-chart.component.js +0 -75
  81. package/esm2015/lib/components/specializations/es-chart.component.js +0 -108
  82. package/esm2015/lib/components/specializations/es-line-chart.component.js +0 -98
  83. package/esm2015/lib/components/specializations/es-pie-chart.component.js +0 -89
  84. package/esm2015/lib/components/specializations/es-vertical-2d-chart.component.js +0 -87
  85. package/esm2015/lib/components/specializations/es-vertical-chart.component.js +0 -85
  86. package/esm2015/lib/components/specializations/es-vertical-stacked-chart.component.js +0 -85
  87. package/esm2015/lib/es-charts.module.js +0 -42
  88. package/esm2015/lib/models/core/classes/ChartDispatcher.js +0 -88
  89. package/esm2015/lib/services/classes/AreaChartService.js +0 -135
  90. package/esm2015/lib/services/classes/LineChartService.js +0 -326
  91. package/esm2015/lib/services/classes/PieChartService.js +0 -112
  92. package/esm2015/lib/services/classes/Vertical2DChartService.js +0 -163
  93. package/esm2015/lib/services/classes/VerticalChartService.js +0 -105
  94. package/esm2015/lib/services/classes/VerticalStackedChartService.js +0 -127
  95. package/esm2015/public-api.js +0 -36
  96. package/fesm2015/esfaenza-es-charts.js.map +0 -1
@@ -0,0 +1,2701 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChild, InjectionToken, Inject, Directive, PLATFORM_ID, NgModule } from '@angular/core';
3
+ import * as i4 from '@angular/common';
4
+ import { isPlatformBrowser, CommonModule } from '@angular/common';
5
+ import * as am4core from '@amcharts/amcharts4/core';
6
+ import * as am4charts from '@amcharts/amcharts4/charts';
7
+ import * as i2 from '@esfaenza/extensions';
8
+
9
+ /**
10
+ * Adapter Base da reimplementare per trasformare i dati da una libreria di grafici a questa per evitare di riscrivere tutto il codice di
11
+ * generazione delle serie in caso si fossero usati grafici di altre librerie
12
+ */
13
+ class BaseAdapter {
14
+ /**
15
+ * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per gli Area Chart
16
+ */
17
+ adaptDataForAreaChart(anyData) {
18
+ return anyData;
19
+ }
20
+ /**
21
+ * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Line Chart
22
+ */
23
+ adaptDataForLineChart(anyData) {
24
+ return anyData;
25
+ }
26
+ /**
27
+ * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Line Chart
28
+ */
29
+ adaptDataForPieChart(anyData) {
30
+ return anyData;
31
+ }
32
+ /**
33
+ * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Vertical Chart
34
+ */
35
+ adaptDataForVerticalChart(anyData) {
36
+ return anyData;
37
+ }
38
+ /**
39
+ * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Vertical Chart a due dimensioni
40
+ */
41
+ adaptDataForVertical2DChart(anyData) {
42
+ return anyData;
43
+ }
44
+ /**
45
+ * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Vertical Chart sovrapposti
46
+ */
47
+ adaptDataForVerticalStackedChart(anyData) {
48
+ return anyData;
49
+ }
50
+ }
51
+ BaseAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
52
+ BaseAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseAdapter });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseAdapter, decorators: [{
54
+ type: Injectable
55
+ }] });
56
+
57
+ /**
58
+ * Dati relativi a un grafico di tipo LineChart
59
+ */
60
+ class LineChartData {
61
+ /**
62
+ * Costruttore
63
+ *
64
+ * @param {LineSerie[]} series Lista di serie da graficare
65
+ * @param {{upper: lower}}
66
+ */
67
+ constructor(series = [], limit) {
68
+ this.series = series;
69
+ this.limit = limit;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Dati relativi a un grafico di tipo PieChart
75
+ */
76
+ class PieChartData {
77
+ /**
78
+ * Costruttore
79
+ *
80
+ * @param {KeyValueColor[]} values Lista di Chiave-Valore-Colore che rappresentano ognuno uno spicchio del grafico a torta
81
+ */
82
+ constructor(values = []) {
83
+ this.values = values;
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Dati relativi a un grafico di tipo AreaChart
89
+ */
90
+ class AreaChartData {
91
+ /**
92
+ * Costruttore
93
+ *
94
+ * @param {{ name: Date; values: KeyValue[]; }[]} groups Gruppi di valori raggruppati per data
95
+ * @param {BaseInterval} interval Intervallo della serie. Viene utilizzato per gestire eventuali Gap
96
+ */
97
+ constructor(groups = [], interval) {
98
+ this.groups = groups;
99
+ this.interval = interval;
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Dati relativi a un grafico di tipo Vertical2DChart
105
+ */
106
+ class Vertical2DChartData {
107
+ /**
108
+ * Costruttore
109
+ *
110
+ * @param {{ name: string; values: KeyValue[]; }[]} groups Gruppi di valori raggruppati per nome
111
+ * @param {{ color: string }[]} colorInfos Lista dei colori da utilizzare. Vanno a sovrascrivere quelli di default di amcharts
112
+ */
113
+ constructor(groups = [], colorInfos) {
114
+ this.groups = groups;
115
+ this.colorInfos = colorInfos;
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Dati relativi a un grafico di tipo VerticalChart
121
+ */
122
+ class VerticalChartData {
123
+ /**
124
+ * Costruttore
125
+ *
126
+ * @param {KeyValue[]} values Lista di Chiave-Valore che rappresentano ognuno una colonna
127
+ */
128
+ constructor(values = []) {
129
+ this.values = values;
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Dati relativi a un grafico di tipo VerticalStackedChart
135
+ */
136
+ class VerticalStackedChartData {
137
+ /**
138
+ * Costruttore
139
+ *
140
+ * @param {{ name: string; values: KeyValue[]; }[]} groups Gruppi di valori raggruppati per nome
141
+ */
142
+ constructor(groups = []) {
143
+ this.groups = groups;
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Classe che racchiude le impostazioni base bene o male applicabili ad ogni Grafico
149
+ */
150
+ class BaseSettings {
151
+ }
152
+
153
+ /**
154
+ * Classe che presenta le impostazioni di generazione per i grafici di tipo AreaChart
155
+ */
156
+ class AreaChartSettings extends BaseSettings {
157
+ /**
158
+ * @ignore
159
+ */
160
+ constructor() { super(); }
161
+ }
162
+
163
+ /**
164
+ * Classe che presenta le impostazioni di generazione per i grafici di tipo LineChart
165
+ */
166
+ class LineChartSettings extends BaseSettings {
167
+ /**
168
+ * @ignore
169
+ */
170
+ constructor() { super(); }
171
+ }
172
+
173
+ /**
174
+ * Classe che presenta le impostazioni di generazione per i grafici di tipo PieChart
175
+ */
176
+ class PieChartSettings extends BaseSettings {
177
+ }
178
+
179
+ /**
180
+ * Classe che presenta le impostazioni di generazione per i grafici di tipo Vertical2DChart
181
+ */
182
+ class Vertical2DChartSettings extends BaseSettings {
183
+ /**
184
+ * @ignore
185
+ */
186
+ constructor() { super(); }
187
+ }
188
+
189
+ /**
190
+ * Classe che presenta le impostazioni di generazione per i grafici di tipo VerticalChart
191
+ */
192
+ class VerticalChartSettings extends BaseSettings {
193
+ /**
194
+ * @ignore
195
+ */
196
+ constructor() { super(); }
197
+ }
198
+
199
+ /**
200
+ * Classe che presenta le impostazioni di generazione per i grafici di tipo VerticalStackedChart
201
+ */
202
+ class VerticalStackedChartSettings extends BaseSettings {
203
+ /**
204
+ * @ignore
205
+ */
206
+ constructor() { super(); }
207
+ }
208
+
209
+ /**
210
+ * Classe che identifica un intervallo di tempo fra un dato e l'altro
211
+ */
212
+ class BaseInterval {
213
+ }
214
+
215
+ /**
216
+ * Classe che identifica le informazioni di Padding per la Legenda
217
+ */
218
+ class LegendPad {
219
+ }
220
+
221
+ /**
222
+ * Modello che identifica un limite superiore - inferiore
223
+ */
224
+ class Limit {
225
+ /** @ignore */
226
+ constructor(upper, upperLabel, upperColor, lower, lowerLabel, lowerColor) {
227
+ this.upper = upper;
228
+ this.upperLabel = upperLabel;
229
+ this.upperColor = upperColor;
230
+ this.lower = lower;
231
+ this.lowerLabel = lowerLabel;
232
+ this.lowerColor = lowerColor;
233
+ }
234
+ }
235
+
236
+ /**
237
+ * Modello che identifica la coppia Data-Valore
238
+ */
239
+ class DateValue {
240
+ /** @ignore */
241
+ constructor(d, v) {
242
+ this.d = d;
243
+ this.v = v;
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Modello che identifica la coppia Chiave-Valore
249
+ */
250
+ class KeyValue {
251
+ /** @ignore */
252
+ constructor(k, v) {
253
+ this.k = k;
254
+ this.v = v;
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Modello che identifica la coppia Chiave-Valore con in aggiunta il Colore da usare per la serie che verrà creata da questo modello
260
+ */
261
+ class KeyValueColor {
262
+ /** @ignore */
263
+ constructor(k, v, c) {
264
+ this.k = k;
265
+ this.v = v;
266
+ this.c = c;
267
+ }
268
+ }
269
+
270
+ /**
271
+ * Modello che identifica una serie a Linea
272
+ */
273
+ class LineSerie {
274
+ /**
275
+ * Costruttore
276
+ *
277
+ * @param {string} name Nome della serie
278
+ * @param {DateValue[]} values Valori della serie
279
+ * @param {BaseInterval} interval Intervallo della serie. Viene utilizzato per gestire Gap e date in Istante Finale
280
+ * @param {string} color Colore della serie, verrà usato sia per la linea base che eventualmente per il riempimento (in caso si utilizzi l'Input **Fill** nel grafico)
281
+ * @param {string} uom Unità di misura da presentare nell'asse delle Y
282
+ * @param {boolean} fill Override della proprietà **Fill** del grafico, specifico per ogni serie
283
+ */
284
+ constructor(name, values, interval, color, uom, fill) {
285
+ this.name = name;
286
+ this.values = values;
287
+ this.interval = interval;
288
+ this.color = color;
289
+ this.uom = uom;
290
+ this.fill = fill;
291
+ }
292
+ }
293
+
294
+ /**
295
+ * Componente che si occupa della paginazione dei grafici qualora servisse
296
+ */
297
+ class PageChartSelector {
298
+ constructor() {
299
+ /**
300
+ * Indica un cambio di pagina ed emette un oggetto con i dati attuali e l'indice attuale.
301
+ *
302
+ * Qualora la proprietà **data** fosse null indica un evento di "loading"
303
+ */
304
+ this.onPageChange = new EventEmitter();
305
+ }
306
+ /**
307
+ * @ignore
308
+ */
309
+ ngOnChanges() {
310
+ if (!(this.Items || this.Dtos) || (this.Items || this.Dtos).length == 0)
311
+ throw new Error("Chart array cannot be empty!");
312
+ var idx = (this.StartIndex || 0);
313
+ this.currentindex = idx;
314
+ this.currentpage = idx + 1;
315
+ this.handlePageChange();
316
+ }
317
+ /**
318
+ * Gestisce un cambio pagina inviando al callback **onPageChange** i dati attuali (siano essi il Dto per il caricamento dati i
319
+ * o i dati già presenti) e l'indice di visualizzazione
320
+ */
321
+ handlePageChange() {
322
+ this.finalIndex = this.currentpage - 1;
323
+ this.currentindex = this.currentpage - 1;
324
+ let data = this.Items && this.Items.length > 0 ? this.Items[this.finalIndex].data : this.Dtos[this.finalIndex];
325
+ this.onPageChange.emit({ data: data, index: this.finalIndex });
326
+ }
327
+ /**
328
+ * Visualizza il grafico successivo
329
+ */
330
+ Next() {
331
+ // Per passare da page a index è sempre un -1
332
+ this.currentpage++;
333
+ this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
334
+ // Delay pseudo-intelligente per click compulsivi.
335
+ // Se dopo questo delay sono andato avanti solo di 1 effettuo il callback altrimenti incremento l'indice
336
+ setTimeout(() => {
337
+ if (this.currentindex == this.currentpage - 2)
338
+ this.handlePageChange();
339
+ else
340
+ this.currentindex++;
341
+ }, this.BrowseDelayMs);
342
+ }
343
+ /**
344
+ * Visualizza il grafico precedente
345
+ */
346
+ Previous() {
347
+ // Per passare da page a index è sempre un -1
348
+ this.currentpage--;
349
+ this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
350
+ // Delay pseudo-intelligente per click compulsivi.
351
+ // Se dopo questo delay sono andato indietro solo di 1 effettuo il callback altrimenti decremento l'indice
352
+ setTimeout(() => {
353
+ if (this.currentindex == this.currentpage)
354
+ this.handlePageChange();
355
+ else
356
+ this.currentindex--;
357
+ }, this.BrowseDelayMs);
358
+ }
359
+ }
360
+ PageChartSelector.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PageChartSelector, deps: [], target: i0.ɵɵFactoryTarget.Component });
361
+ PageChartSelector.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: PageChartSelector, selector: "chart-pager", inputs: { Items: "Items", Dtos: "Dtos", BrowseDelayMs: "BrowseDelayMs", StartIndex: "StartIndex" }, outputs: { onPageChange: "onPageChange" }, queries: [{ propertyName: "headerInner_tr", first: true, predicate: ["header_inner"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"(Items || Dtos) && (Items || Dtos).length > 0\" class=\"pcs-no-selection\">\r\n <div class=\"pcs-button pcs-backward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"currentpage != 1 && Previous(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"currentpage == 1 ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-left\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div class=\"pcs-infos\">\r\n <ng-container *ngIf=\"headerInner_tr\">\r\n <ng-container *ngTemplateOutlet=\"headerInner_tr; context : {$implicit: (Items || Dtos)[currentpage - 1]}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"pcs-button pcs-forward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"(Items || Dtos).length != currentpage && Next(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"(Items || Dtos).length == currentpage ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-right\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div style=\"clear: both;\"></div>\r\n</div>", styles: [".pcs-button{width:60px}.pcs-forward{float:right;text-align:end}.pcs-backward{float:left}.pcs-svg-header{width:57px;height:40px}.pcs-svg-button-container{outline:currentcolor none medium}.pcs-svg-arrow{pointer-events:none;fill:#555}.pcs-svg-arrow-right{transform:translate(44px,36px) rotate(180deg)}.pcs-svg-arrow-left{transform:translate(13px,4px)}.pcs-svg-button{fill:#d9d9d9;stroke:#fff;fill-opacity:1;stroke-opacity:1}.pcs-svg-button:hover{fill:#a3a3a3;cursor:pointer}.pcs-infos{width:calc(100% - 120px);height:44px;float:left}.pcs-no-selection{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
362
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PageChartSelector, decorators: [{
363
+ type: Component,
364
+ args: [{ selector: "chart-pager", changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"(Items || Dtos) && (Items || Dtos).length > 0\" class=\"pcs-no-selection\">\r\n <div class=\"pcs-button pcs-backward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"currentpage != 1 && Previous(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"currentpage == 1 ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-left\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div class=\"pcs-infos\">\r\n <ng-container *ngIf=\"headerInner_tr\">\r\n <ng-container *ngTemplateOutlet=\"headerInner_tr; context : {$implicit: (Items || Dtos)[currentpage - 1]}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"pcs-button pcs-forward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"(Items || Dtos).length != currentpage && Next(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"(Items || Dtos).length == currentpage ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-right\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div style=\"clear: both;\"></div>\r\n</div>", styles: [".pcs-button{width:60px}.pcs-forward{float:right;text-align:end}.pcs-backward{float:left}.pcs-svg-header{width:57px;height:40px}.pcs-svg-button-container{outline:currentcolor none medium}.pcs-svg-arrow{pointer-events:none;fill:#555}.pcs-svg-arrow-right{transform:translate(44px,36px) rotate(180deg)}.pcs-svg-arrow-left{transform:translate(13px,4px)}.pcs-svg-button{fill:#d9d9d9;stroke:#fff;fill-opacity:1;stroke-opacity:1}.pcs-svg-button:hover{fill:#a3a3a3;cursor:pointer}.pcs-infos{width:calc(100% - 120px);height:44px;float:left}.pcs-no-selection{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}\n"] }]
365
+ }], propDecorators: { Items: [{
366
+ type: Input
367
+ }], Dtos: [{
368
+ type: Input
369
+ }], BrowseDelayMs: [{
370
+ type: Input
371
+ }], StartIndex: [{
372
+ type: Input
373
+ }], onPageChange: [{
374
+ type: Output
375
+ }], headerInner_tr: [{
376
+ type: ContentChild,
377
+ args: ['header_inner', { static: false }]
378
+ }] } });
379
+
380
+ /**
381
+ * Token che identifica il Locale di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
382
+ */
383
+ const ESC_LOCALE = new InjectionToken('ESC_LOCALE');
384
+ /**
385
+ * Token che identifica il default per l'utilizzo o meno delle Animazioni per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
386
+ */
387
+ const ESC_ANIMATIONS = new InjectionToken('ESC_ANIMATIONS');
388
+ /**
389
+ * Token che identifica il Tema di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
390
+ */
391
+ const ESC_THEME = new InjectionToken('ESC_THEME');
392
+ /**
393
+ * Token che identifica l'utilizzo o meno del sistema di Log per l'intera libreria
394
+ */
395
+ const ESC_LOGS = new InjectionToken('ESC_LOGS');
396
+
397
+ /**
398
+ * Classe che si occupa del dispatch delle operazioni di rendering dei grafici utilizzando una coda per permettere ad ogni grafico di avere temi e localizzazione custom
399
+ */
400
+ class ChartDispatcher {
401
+ /**
402
+ * @ignore
403
+ */
404
+ constructor(logs) {
405
+ this.logs = logs;
406
+ /**
407
+ * Coda di inizializzazioni ancora da eseguire. Quando questa è vuota significa che nessuno sta creando grafici
408
+ */
409
+ this.Initializations = [];
410
+ /**
411
+ * Lista dei grafici inizializzati e attivi in un dato momento (viene registrata la proprietà **name**). Non è possibile registrare due grafici con lo stesso identificativo
412
+ */
413
+ this.InitializedGraphs = [];
414
+ }
415
+ /**
416
+ * Registra un grafico da visualizzare insieme alla propria funzione di creazione. Quest'ultima sarà differita fino a che tutti i grafici
417
+ * precedentemente registati non hanno finito la fase di inizializzazione
418
+ *
419
+ * @param {string} name Identificativo del grafico da registrare
420
+ * @param {Function} chartCreationFunction Funzione che fisicamente dovrà occuparsi della creazione del grafico
421
+ */
422
+ register(name, chartCreationFunction) {
423
+ if (this.InitializedGraphs.indexOf(name) != -1)
424
+ throw "Attempting to register a duplicate chart '" + name + "'. Make sure the 'name' properties of your charts are univoque";
425
+ this.log("DISPATCHER: Registering chart creation function execution for " + name);
426
+ this.Initializations.push({ name: name, function: chartCreationFunction });
427
+ if (this.Initializations.length == 1) {
428
+ this.log("DISPATCHER: Initial drain started");
429
+ this.drainInitQueues();
430
+ }
431
+ }
432
+ /**
433
+ * Deregistra un grafico presente. Chiamata generalmente al dispose del grafico in questione quando non dev'essere più mostrato nella pagina corrente
434
+ *
435
+ * @param {string} name Identificativo del grafico da deregistrare
436
+ */
437
+ deregisterGraph(name) {
438
+ let index = this.InitializedGraphs.indexOf(name);
439
+ if (index == -1) {
440
+ //Questo succede quando si cerca di distruggere il grafico mentre sta venendo graficato
441
+ this.log("DISPATCHER: Registration missing for chart " + name + " it was probably destroyed during load");
442
+ return;
443
+ }
444
+ this.log("DISPATCHER: Chart deregistered " + name);
445
+ this.InitializedGraphs.splice(index, 1);
446
+ }
447
+ /**
448
+ * Metodo che esegue in maniera sequenziale le funzioni di inizializzazione dei grafici finché presenti
449
+ * in modo che nessun grafico possa essere inizializzato contemporaneamente ad un altro.
450
+ *
451
+ * Questo è il punto chiave che permette di avere per ogni grafico temi e locale differenti
452
+ */
453
+ drainInitQueues() {
454
+ let toExecute = this.Initializations[0];
455
+ this.log("DISPATCHER: Executing initialization function for chart " + toExecute.name);
456
+ toExecute.function().then(() => {
457
+ this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
458
+ this.InitializedGraphs.push(toExecute.name);
459
+ this.Initializations.splice(0, 1);
460
+ if (this.Initializations.length >= 1) {
461
+ this.log("DISPATCHER: Found queued initializations. Continuing");
462
+ this.drainInitQueues();
463
+ }
464
+ else
465
+ this.log("DISPATCHER: queue is over, nothing more to do");
466
+ });
467
+ }
468
+ /**
469
+ * @ignore
470
+ */
471
+ log(text) {
472
+ if (this.logs)
473
+ console.log("@esfaenza/es-charts: " + text);
474
+ }
475
+ }
476
+ ChartDispatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartDispatcher, deps: [{ token: ESC_LOGS }], target: i0.ɵɵFactoryTarget.Injectable });
477
+ ChartDispatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartDispatcher });
478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartDispatcher, decorators: [{
479
+ type: Injectable
480
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
481
+ type: Inject,
482
+ args: [ESC_LOGS]
483
+ }] }]; } });
484
+
485
+ /** @ignore */
486
+ const _spiritedaway = 'spiritedaway';
487
+ /** @ignore */
488
+ const _moonrisekingdom = 'moonrisekingdom';
489
+ /** @ignore */
490
+ const _frozen = 'frozen';
491
+ /** @ignore */
492
+ const _dark = 'dark';
493
+ /** @ignore */
494
+ const _kelly = 'kelly';
495
+ /** @ignore */
496
+ const _material = 'material';
497
+ /** @ignore */
498
+ const _dataviz = 'dataviz';
499
+ /** @ignore */
500
+ const _none = 'none';
501
+ /** @ignore */
502
+ const _animated = 'animated';
503
+ /**
504
+ * Classe per enumerare i temi disponibili nella libreria
505
+ */
506
+ // @dynamic
507
+ class ChartThemes {
508
+ get spiritedaway() { return _spiritedaway; }
509
+ ;
510
+ get moonrisekingdom() { return _moonrisekingdom; }
511
+ ;
512
+ get frozen() { return _frozen; }
513
+ ;
514
+ get dark() { return _dark; }
515
+ ;
516
+ get kelly() { return _kelly; }
517
+ ;
518
+ get material() { return _material; }
519
+ ;
520
+ get dataviz() { return _dataviz; }
521
+ ;
522
+ get none() { return _none; }
523
+ ;
524
+ get animated() { return _animated; }
525
+ ;
526
+ static get spiritedaway() { return _spiritedaway; }
527
+ ;
528
+ static get moonrisekingdom() { return _moonrisekingdom; }
529
+ ;
530
+ static get frozen() { return _frozen; }
531
+ ;
532
+ static get dark() { return _dark; }
533
+ ;
534
+ static get kelly() { return _kelly; }
535
+ ;
536
+ static get material() { return _material; }
537
+ ;
538
+ static get dataviz() { return _dataviz; }
539
+ ;
540
+ static get none() { return _none; }
541
+ ;
542
+ static get animated() { return _animated; }
543
+ ;
544
+ }
545
+
546
+ /**
547
+ * Classe di supporto al caricamento dinamico dei vari pezzi di amcharts che mi servono per il grafico (temi, locali, ecc...)
548
+ *
549
+ * Essenzialmente ogni volta che viene creato un grafico, questo acquisisce il tema e il locale applicato IN QUEL MOMENTO,
550
+ * questo significa che per creare due grafici con temi diversi bisogna fare:
551
+ *
552
+ * 1) Caricamento tema 1
553
+ *
554
+ * 2) Creazione grafico 1
555
+ *
556
+ * 3) Scaricamento tema 1
557
+ *
558
+ * 3) Caricamento tema 2
559
+ *
560
+ * 4) Creazione grafico 2
561
+ *
562
+ */
563
+ class ChartLoader {
564
+ /**
565
+ * @ignore
566
+ */
567
+ constructor(logs) {
568
+ this.logs = logs;
569
+ /**
570
+ * Indica se attualmente ho le animazioni caricate in modo da non ricaricarle inutilmente
571
+ */
572
+ this.AnimationsAreLoaded = false;
573
+ /**
574
+ * Indica l'ultimo tema caricato in modo da non ricaricarlo inutilmente qualora il prossimo grafico da creare richieda lo stesso tema
575
+ */
576
+ this.LastLoadedTheme = "";
577
+ /**
578
+ * Cache dei temi (moduli caricati dinamicamente)
579
+ */
580
+ this.themeCache = {};
581
+ /**
582
+ * Cache delle localizzazioni (moduli caricati dinamicamente)
583
+ */
584
+ this.localizationCache = {};
585
+ }
586
+ /**
587
+ * Applica il tema con le animazioni all'istanza globale di amCharts
588
+ *
589
+ * @param {Object} chartsCore Istanza globale di amCharts
590
+ * @returns {Promise} Promise che identifica la fine del caricamento
591
+ */
592
+ applyAnimations(chartsCore) {
593
+ if (!this.AnimationsAreLoaded) {
594
+ return this.importIfNeeded('themes', ChartThemes.animated).then(() => {
595
+ this.log("CORE: Applying theme " + ChartThemes.animated);
596
+ chartsCore.useTheme(this.themeCache[ChartThemes.animated]);
597
+ this.AnimationsAreLoaded = true;
598
+ });
599
+ }
600
+ else {
601
+ this.log("CORE: theme already applyed " + ChartThemes.animated);
602
+ return new Promise((resolve) => { resolve(true); });
603
+ }
604
+ }
605
+ /**
606
+ * De-applica il tema con le animazioni dall'istanza globale di amCharts
607
+ *
608
+ * @param {Object} chartsCore Istanza globale di amCharts
609
+ * @returns {Promise} Promise che identifica la fine dello scarico
610
+ */
611
+ unapplyAnimations(chartsCore) {
612
+ if (this.AnimationsAreLoaded) {
613
+ this.log("CORE: Animations in use, unapplying theme " + ChartThemes.animated);
614
+ chartsCore.unuseTheme(this.themeCache[ChartThemes.animated]);
615
+ this.AnimationsAreLoaded = false;
616
+ }
617
+ else
618
+ this.log("CORE: Animations already unused, no need to unapply them");
619
+ return new Promise((resolve) => { resolve(true); });
620
+ }
621
+ /**
622
+ * Applica il tema specificato all'istanza globale di amCharts
623
+ *
624
+ * @param {Object} chartsCore Istanza globale di amCharts
625
+ * @param {'spiritedaway' | 'moonrisekingdom' | 'frozen' | 'dark' | 'kelly' | 'material' | 'dataviz' | 'none'} theme Tema da applicare
626
+ * @returns {Promise} Promise che identifica la fine del caricamento
627
+ */
628
+ applyTheme(chartsCore, theme) {
629
+ // Ultimo tema applicato è lo stesso che mi è stato richiesto di applicare --> NO-OP
630
+ if (this.LastLoadedTheme == theme) {
631
+ this.log("CORE: theme already applied " + theme);
632
+ return new Promise((resolve) => { resolve(true); });
633
+ }
634
+ // Scarico il tema precedente a prescindere, ormai non mi serve più
635
+ this.unapplyPreviousTheme(chartsCore);
636
+ // Il tema è il none --> registro la cosa e basta, il tema precedente è stato rimosso subito qui sopra ^
637
+ if (theme == ChartThemes.none) {
638
+ this.LastLoadedTheme = ChartThemes.none;
639
+ return new Promise((resolve) => { resolve(true); });
640
+ }
641
+ // Il tema è diverso dal precedente e non è il tema vuoto --> Importo il tema specificato se non presente in memoria e lo applico al grafico attuale
642
+ return this.importIfNeeded('themes', theme).then(() => {
643
+ this.log("CORE: Applying theme " + theme);
644
+ chartsCore.useTheme(this.themeCache[theme]);
645
+ this.LastLoadedTheme = theme;
646
+ });
647
+ }
648
+ /**
649
+ * De-applica il tema precedente dall'istanza globale di amCharts
650
+ *
651
+ * @param {Object} chartsCore Istanza globale di amCharts
652
+ */
653
+ unapplyPreviousTheme(chartsCore) {
654
+ if (!this.LastLoadedTheme || this.LastLoadedTheme == ChartThemes.none)
655
+ return;
656
+ this.log("CORE: Unapplying previously used theme " + this.LastLoadedTheme);
657
+ chartsCore.unuseTheme(this.themeCache[this.LastLoadedTheme]);
658
+ }
659
+ /**
660
+ * Applica il locale specificato all'istanza specifica del grafico
661
+ *
662
+ * @param {amCharts.Chart} chart Istanza specifica del grafico a cui applicare il locale
663
+ * @param {string} locale Locale da applicare
664
+ * @returns {Promise} Promise che identifica la fine del caricamento
665
+ */
666
+ applyLocale(chart, locale) {
667
+ return this.importIfNeeded('lang', locale).then(() => {
668
+ this.log("Chart " + chart.htmlContainer.id + ": applying locale " + locale);
669
+ chart.language.locale = this.localizationCache[locale];
670
+ });
671
+ }
672
+ /**
673
+ * Permette di importare, se serve un dato tema o localizzazione
674
+ *
675
+ * @param {'lang' | 'themes'} what Oggetto da importare, se localizzazione o tema
676
+ * @param {string} item Chiave dell'oggetto da importare
677
+ *
678
+ * @returns {Promise} Promise che identifica la fine del caricamento
679
+ */
680
+ importIfNeeded(what, item) {
681
+ // Se sto cercando di caricare qualcosa di già caricato non faccio nulla
682
+ if (!(what == 'themes' && !this.themeCache[item]) && !(what == 'lang' && !this.localizationCache[item])) {
683
+ this.log("CORE: " + (what == 'lang' ? "Language " : "Theme ") + item + " already loaded");
684
+ return new Promise((resolve) => { resolve(true); });
685
+ }
686
+ this.log("CORE: Loading " + (what == 'lang' ? "language " : "theme ") + item);
687
+ /*
688
+ * ****************************
689
+ * ******** ATTENZIONE ********
690
+ * ****************************
691
+ *
692
+ * Se stai vedendo questo codice di import e stai valutando di riscriverlo come:
693
+ *
694
+ * V V
695
+ * import(`@amcharts/amcharts4/${what}/${item}`).then(module => {
696
+ * if (what == 'themes') this.themeCache[item] = module.default;
697
+ * else if (what == 'lang') this.localizationCache[item] = module.default;
698
+ * });
699
+ *
700
+ * Sappi che è una pessima idea. Gli import sono valutati da webpack in compiletime per generare i chunk,
701
+ * mettere la navigazione agli import con la concatenazione viene preso malissimo ed essenzialmente dice a webpack
702
+ * di tirare su e bundlare l'intera node_modules. Divertente, no?
703
+ *
704
+ */
705
+ switch (what) {
706
+ case 'themes':
707
+ switch (item) {
708
+ case ChartThemes.spiritedaway:
709
+ return import('@amcharts/amcharts4/themes/spiritedaway').then(theme => this.themeCache[item] = theme.default);
710
+ case ChartThemes.moonrisekingdom:
711
+ return import('@amcharts/amcharts4/themes/moonrisekingdom').then(theme => this.themeCache[item] = theme.default);
712
+ case ChartThemes.frozen:
713
+ return import('@amcharts/amcharts4/themes/frozen').then(theme => this.themeCache[item] = theme.default);
714
+ case ChartThemes.dark:
715
+ return import('@amcharts/amcharts4/themes/dark').then(theme => this.themeCache[item] = theme.default);
716
+ case ChartThemes.kelly:
717
+ return import('@amcharts/amcharts4/themes/kelly').then(theme => this.themeCache[item] = theme.default);
718
+ case ChartThemes.material:
719
+ return import('@amcharts/amcharts4/themes/material').then(theme => this.themeCache[item] = theme.default);
720
+ case ChartThemes.dataviz:
721
+ return import('@amcharts/amcharts4/themes/dataviz').then(theme => this.themeCache[item] = theme.default);
722
+ case ChartThemes.animated:
723
+ return import('@amcharts/amcharts4/themes/animated').then(theme => this.themeCache[item] = theme.default);
724
+ }
725
+ break;
726
+ case 'lang':
727
+ switch (item) {
728
+ case 'it-IT':
729
+ return import('@amcharts/amcharts4/lang/it_IT').then(lang => this.localizationCache[item] = lang.default);
730
+ case 'en-US':
731
+ return import('@amcharts/amcharts4/lang/en_US').then(lang => this.localizationCache[item] = lang.default);
732
+ }
733
+ }
734
+ this.log("CORE: Loading Failed. " + (what == 'lang' ? "Language " : "Theme") + " not recognized: " + item);
735
+ return new Promise((resolve) => { resolve(true); });
736
+ }
737
+ /**
738
+ * @ignore
739
+ */
740
+ log(text) {
741
+ if (this.logs)
742
+ console.log("@esfaenza/es-charts: " + text);
743
+ }
744
+ }
745
+
746
+ /**
747
+ * Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
748
+ * il tema utilizzato, il locale del singolo grafico, ecc ecc...
749
+ */
750
+ class BaseChartComponent {
751
+ /**
752
+ * Costruttore
753
+ *
754
+ * @param {ElementRef} el Contenitore all'interno del cui viene creato il grafico. Utilizzato per estrapolarne la **ContainerHeight**
755
+ * @param {Object} platformId piattaforma Angular (browser, ecc...) per essere sicuri che amcharts venga attivato solo lato browser. Non utilizzando SSR nelle applicazioni che consumano questa libreria non è particolarmente significativo, ma non si sa mai
756
+ * @param {NgZone} zone NgZone di default per permettere di inizializzare il grafico all'infuori di Angular per avere qualche prestazione in più
757
+ * @param {ChartLoader} Charter Istanza del Loader che si occuperà di caricare in memoria tutto ciò che serve per il grafico attuale (temi, locale, animazioni, ecc...)
758
+ * @param {ChartDispatcher} Dispatcher Istanza del Dispatcher che si occupa di differire il caricamento dei grafici 1 dopo l'altro in modo che caricamenti pseudo paralleli incasinino tutto
759
+ * @param {boolean} logs Indica se effettuare log a console o meno, iniettato dalle classi specializzate dal token ESC_LOGS
760
+ * @param {boolean} animations Indica se per questo grafico devono essere attive o meno le animazioni. Impostazione generica presa dal token ESC_ANIMATIONS
761
+ * @param {string} locale Indica il locale specifico per questo grafico. Impostazione generica presa dal token ESC_LOCALE
762
+ * @param {string} theme Indica il tema specifico per questo grafico. Impostazione generica presa dal token ESC_THEME
763
+ */
764
+ constructor(el, platformId, zone, Charter, Dispatcher, logs, animations, locale, theme) {
765
+ this.el = el;
766
+ this.platformId = platformId;
767
+ this.zone = zone;
768
+ this.Charter = Charter;
769
+ this.Dispatcher = Dispatcher;
770
+ this.logs = logs;
771
+ this.animations = animations;
772
+ this.locale = locale;
773
+ this.theme = theme;
774
+ /**
775
+ * Nome del grafico, fondamentale assegnarlo per permettere alla libreria di schedularne la creazione
776
+ */
777
+ this.name = "";
778
+ /**
779
+ * Dopo aver navigato a un nuovo grafico verranno attesi questi millisecondi prima di richiedere i dati attraverso la **DataRetrieve**.
780
+ *
781
+ * Questo per evitare che l'utente cliccando velocemente "avanti" generi tonnellate di richieste inutili
782
+ */
783
+ this.BrowseDelayMs = 500;
784
+ /**
785
+ * Evento lanciato sulla selezione di un range di dati o dalla timeline o dal grafico. Valido per tutti i grafici che supportano serie basate sulle date
786
+ */
787
+ this.onSelectionChanged = new EventEmitter();
788
+ /**
789
+ * Evento lanciato dal click di una serie dalla Legenda, a patto che l'Input **HideSeriesOnLabelClick** sia impostato a false
790
+ */
791
+ this.onSeriesClicked = new EventEmitter();
792
+ /**
793
+ * Evento lanciato all'inizio del caricamento di una nuova pagina del grafico
794
+ */
795
+ this.onLoadStart = new EventEmitter();
796
+ /**
797
+ * Evento lanciato al termine del caricamento di una nuova pagina del grafico
798
+ */
799
+ this.onLoadEnd = new EventEmitter();
800
+ /**
801
+ * Serve a decidere se sarà presente l'interfaccia di paginazione
802
+ */
803
+ this.isPaged = false;
804
+ /**
805
+ * @ignore
806
+ */
807
+ this.initDone = false;
808
+ }
809
+ /**
810
+ * Metodo di inizializzazione post valorizzazione degli input, utilizzato per valorizzare correttamente le proprietà essenziali del grafico (Animazioni, Tema e Locale)
811
+ *
812
+ * Viene data priorità ai Settings (HTML), priorità secondaria agli Input diretti (Lato HTML), priorità ultima alle impostazioni globali,
813
+ * impostate in fase di import del modulo assegnando valori ai token ESC_LOCALE, ESC_ANIMATIONS, ESC_THEME
814
+ */
815
+ ngOnInit() {
816
+ // Qui servono solo le variabili da conoscere PRE-graficazione per il caricamento dei moduli lazy del grafico
817
+ this.Animations = this.Settings?.Animations != null ? this.Settings?.Animations : (this.Animations != null ? this.Animations : this.animations);
818
+ this.Theme = this.Settings?.Theme != null ? this.Settings?.Theme : (this.Theme != null ? this.Theme : this.theme);
819
+ this.Locale = this.Settings?.Locale != null ? this.Settings?.Locale : (this.Locale != null ? this.Locale : this.locale);
820
+ this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve);
821
+ this.log("Chart " + this.name + ": ngOnInit");
822
+ }
823
+ /**
824
+ * Implementazione utilizzata per controllare eventuali proprietà chiave del grafico e rigraficare tutto qualora si rivelasse necessario
825
+ *
826
+ * @param {SimpleChanges} changes Indicazione dei cambiamenti sulle proprietà del grafico. Vedere documentazione Angular in merito
827
+ */
828
+ ngOnChanges(changes) {
829
+ if (!this.initDone)
830
+ return;
831
+ this.log("Chart " + this.name + ": ngOnChanges");
832
+ let propsToCheck = ["Timeline", "Legend", "Settings", "Animations", "Theme", "Locale", ...this.getSpecificPropertiesToCheck()];
833
+ this.checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck);
834
+ }
835
+ /**
836
+ * Nel post inizializzazione, a patto che mi trovi in ambiente "browser", proseguo al caricamento del grafico sull'HTML
837
+ */
838
+ ngAfterViewInit() {
839
+ if (!this.name)
840
+ throw "a Unique name is mandatory to create a chart";
841
+ this.log("Chart " + this.name + ": ngAfterViewInit, graphicating chart outside Angular");
842
+ if (!this.isPaged)
843
+ this.dispatchLoadChart();
844
+ }
845
+ /**
846
+ * All'onDestroy scarico il grafico per liberare memoria
847
+ */
848
+ ngOnDestroy() {
849
+ if (this.Chart) {
850
+ this.log("Chart " + this.name + ": Unloading destroyed chart");
851
+ this.browserOnly(() => { this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
852
+ }
853
+ else
854
+ this.log("Chart " + this.name + ": Unloading uncreated chart component. It probably was a duplicated");
855
+ }
856
+ /**
857
+ * Registra il grafico attuale nel Dispatcher in modo che venga caricato appena possibile
858
+ */
859
+ dispatchLoadChart() {
860
+ this.browserOnly(() => {
861
+ this.Dispatcher.register(this.name, () => { return this.loadChart(); });
862
+ });
863
+ }
864
+ /**
865
+ * Il caricamento del grafico funziona nel seguente modo:
866
+ *
867
+ * 1) Caricamento del tema e delle animazioni, qualora necessari
868
+ *
869
+ * 2) Caricamento delle impostazioni specifiche e integrazione con le impostazioni generiche
870
+ *
871
+ * 3) Graficazione
872
+ *
873
+ * 4) Caricamento del locale
874
+ */
875
+ loadChart() {
876
+ this.log("Chart " + this.name + ": Start loading Modules if needed");
877
+ return Promise.all([
878
+ this.setupAmChartsThemes().then(() => {
879
+ this.log("Chart " + this.name + ": Graphicating after modules load");
880
+ var castedSettings = this.getCastedSettings();
881
+ this.fillSettings(castedSettings);
882
+ this.fillSpecificSettings(castedSettings);
883
+ this.ChartService = this.graphicate(castedSettings);
884
+ this.Chart = this.ChartService.ChartInstance;
885
+ if (!this.Chart)
886
+ this.log("Chart " + this.name + ": Could not create graph");
887
+ return this.Charter.applyLocale(this.Chart, this.Locale).then(() => this.initDone = true);
888
+ })
889
+ ]);
890
+ }
891
+ /**
892
+ * Riempimento delle impostazioni nella classe Settings. Si danno priorità ai valori già impostati nei Settings,
893
+ * integrando eventualmente con le proprietà del grafico
894
+ *
895
+ * @param {BaseSettings} settings Impostazioni base ricevute dalla specializzazione del grafico
896
+ */
897
+ fillSettings(settings) {
898
+ // Merge degli Input con i Settings, dando priorità ai Settings
899
+ settings.Theme = settings.Theme ? settings.Theme : this.Theme;
900
+ settings.Locale = settings.Locale ? settings.Locale : this.Locale;
901
+ settings.Animations = settings.Animations != null ? settings.Animations : this.Animations;
902
+ settings.Legend = settings.Legend != null ? settings.Legend : this.Legend;
903
+ settings.Name = settings.Name ? settings.Name : this.name;
904
+ settings.Timeline = settings.Timeline != null ? settings.Timeline : this.Timeline;
905
+ settings.AdaptLabelSizeAndOrientation = settings.AdaptLabelSizeAndOrientation != null ? settings.AdaptLabelSizeAndOrientation : this.AdaptLabelSizeAndOrientation;
906
+ settings.XAxisTitle = settings.XAxisTitle ? settings.XAxisTitle : this.XTitle;
907
+ settings.YAxisTitle = settings.YAxisTitle ? settings.YAxisTitle : this.YTitle;
908
+ settings.LegendPosition = settings.LegendPosition ? settings.LegendPosition : this.LegendPosition;
909
+ settings.HideSeriesOnLabelClick = settings.HideSeriesOnLabelClick != null ? settings.HideSeriesOnLabelClick : this.HideSeriesOnLabelClick;
910
+ settings.MinGridDistance = settings.MinGridDistance != null ? settings.MinGridDistance : this.MinGridDistance;
911
+ settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : this.LegendPadding ?? null;
912
+ settings.ContainerHeight = this.el.nativeElement.parentElement.offsetHeight;
913
+ settings.OnSeriesClickCallback = (series) => { this.onSeriesClicked.emit(series); };
914
+ settings.OnSelectionChangedCallback = (event) => { this.onSelectionChanged.emit({ from: event.from, to: event.to, initial: event.initial }); };
915
+ }
916
+ /**
917
+ * Controlla i cambiamenti avvenuti alle proprietà chiave e rieffettua la graficazione qualora necessario
918
+ *
919
+ * @param {SimpleChanges} changes Indicazione della modifiche avvenute nei vari Input
920
+ * @param {string[]} propsToCheck Lista degli Input da controllare per cui una modifica causa una rigraficazione
921
+ */
922
+ checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck) {
923
+ let toReGraphicate = false;
924
+ for (let i = 0; i < propsToCheck.length; i++)
925
+ toReGraphicate = toReGraphicate || (changes[propsToCheck[i]] && changes[propsToCheck[i]].currentValue);
926
+ if (toReGraphicate)
927
+ this.reloadChart();
928
+ }
929
+ /**
930
+ * Funzione che effettua un cambio di pagina per i grafici paginati. Qualora **data** fosse nullo significa che è iniziato un caricamento
931
+ * e anche lato applicativo il DataRetrieve dovrà considerare che l'assenza di valori non è altro che un'indicazione di inizio caricamento
932
+ *
933
+ * Il caricamento di qualsiasi pagina genererà comunque una primo evento con **data** nullo in modo da indicare l'inizio caricamento e
934
+ * in seconda istanza un altro evento in cui **data** sarà sempre valorizzato, o con il Dto da usare per recuperare i dati, o con i dati
935
+ * veri e propri già presenti nel **DataArray**
936
+ *
937
+ * I callback **onLoadStart** e **onLoadEnd** vengono sempre chiamati
938
+ *
939
+ * @param {{ data: LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any, index: number }} nd Indice del caricamento dati, con eventualmente già i dati se disponibili
940
+ */
941
+ changePage(nd) {
942
+ if (!nd.data) {
943
+ this.loadingChart = true;
944
+ // Serve per informare l'applicativo in listening sull'indice attualmente in visualizzazione.
945
+ // La mancanza di dati indica che non devono essere effettuate ricerche per ora
946
+ if (this.DataRetrieve)
947
+ this.DataRetrieve(null, nd.index);
948
+ this.onLoadStart.emit();
949
+ return;
950
+ }
951
+ if (this.DataRetrieve)
952
+ this.DataRetrieve(nd.data, nd.index).then(t => { this.changePageDataReceived(t); });
953
+ else
954
+ this.changePageDataReceived(nd.data);
955
+ }
956
+ /**
957
+ * Al termine del caricamento dei dati di una pagina questo metodo viene chiamato per rigraficare la situazione con i nuovi dati
958
+ *
959
+ * @param {LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any} data Dati del grafico
960
+ */
961
+ changePageDataReceived(data) {
962
+ this.loadingChart = false;
963
+ this.onLoadEnd.emit();
964
+ let firstBind = !this.Data;
965
+ this.Data = data;
966
+ if (!firstBind)
967
+ this.reloadChart();
968
+ else
969
+ this.dispatchLoadChart();
970
+ }
971
+ /**
972
+ * Ricarica il grafico distruggendo il vecchio e ricreando il nuovo
973
+ *
974
+ * Le chiamate a questo metodo possono essere trasformate in chiamate al metodo **graphicate** della Service, se solo quel metodo fosse abbastanza intelligente per capire
975
+ * le differenze fra il grafico com'era prima e come deve diventare, in modo da non ricrearlo ma semplicemente modificare quello che già è disegnato
976
+ */
977
+ reloadChart() {
978
+ this.browserOnly(() => { if (!this.Chart.isDisposed())
979
+ this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
980
+ this.Dispatcher.register(this.name, () => { return this.loadChart(); });
981
+ }
982
+ /**
983
+ * Funzione che si occupa di caricare i temi necessari per il grafico in oggetto. Prima applica il tema, poi, se serve, applica le animazioni
984
+ */
985
+ setupAmChartsThemes() {
986
+ return Promise.all([
987
+ this.Charter.applyTheme(am4core, this.Theme).then(() => {
988
+ return this.Animations ? this.Charter.applyAnimations(am4core) : this.Charter.unapplyAnimations(am4core);
989
+ })
990
+ ]);
991
+ }
992
+ /**
993
+ * @ignore
994
+ */
995
+ log(log) {
996
+ if (this.logs)
997
+ console.log("@esfaenza/es-charts: " + log);
998
+ }
999
+ /**
1000
+ * @ignore
1001
+ */
1002
+ browserOnly(f) {
1003
+ if (isPlatformBrowser(this.platformId)) {
1004
+ this.zone.runOutsideAngular(() => {
1005
+ f();
1006
+ });
1007
+ }
1008
+ }
1009
+ }
1010
+ BaseChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseChartComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1011
+ BaseChartComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: BaseChartComponent, inputs: { XTitle: "XTitle", YTitle: "YTitle", Settings: "Settings", Legend: "Legend", LegendPosition: "LegendPosition", Timeline: "Timeline", name: "name", Animations: "Animations", Theme: "Theme", Locale: "Locale", HideSeriesOnLabelClick: "HideSeriesOnLabelClick", MinGridDistance: "MinGridDistance", AdaptLabelSizeAndOrientation: "AdaptLabelSizeAndOrientation", LegendPadding: "LegendPadding", DataDtos: "DataDtos", DataDtoStartIndex: "DataDtoStartIndex", DataRetrieve: "DataRetrieve", BrowseDelayMs: "BrowseDelayMs" }, outputs: { onSelectionChanged: "onSelectionChanged", onSeriesClicked: "onSeriesClicked", onLoadStart: "onLoadStart", onLoadEnd: "onLoadEnd" }, queries: [{ propertyName: "header_tr", first: true, predicate: ["header"], descendants: true }, { propertyName: "loading_template", first: true, predicate: ["loading"], descendants: true }], usesOnChanges: true, ngImport: i0 });
1012
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseChartComponent, decorators: [{
1013
+ type: Directive
1014
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: Object }, { type: i0.NgZone }, { type: ChartLoader }, { type: ChartDispatcher }, { type: undefined }, { type: undefined }, { type: undefined }, { type: undefined }]; }, propDecorators: { XTitle: [{
1015
+ type: Input
1016
+ }], YTitle: [{
1017
+ type: Input
1018
+ }], Settings: [{
1019
+ type: Input
1020
+ }], Legend: [{
1021
+ type: Input
1022
+ }], LegendPosition: [{
1023
+ type: Input
1024
+ }], Timeline: [{
1025
+ type: Input
1026
+ }], name: [{
1027
+ type: Input
1028
+ }], Animations: [{
1029
+ type: Input
1030
+ }], Theme: [{
1031
+ type: Input
1032
+ }], Locale: [{
1033
+ type: Input
1034
+ }], HideSeriesOnLabelClick: [{
1035
+ type: Input
1036
+ }], MinGridDistance: [{
1037
+ type: Input
1038
+ }], AdaptLabelSizeAndOrientation: [{
1039
+ type: Input
1040
+ }], LegendPadding: [{
1041
+ type: Input
1042
+ }], DataDtos: [{
1043
+ type: Input
1044
+ }], DataDtoStartIndex: [{
1045
+ type: Input
1046
+ }], DataRetrieve: [{
1047
+ type: Input
1048
+ }], BrowseDelayMs: [{
1049
+ type: Input
1050
+ }], header_tr: [{
1051
+ type: ContentChild,
1052
+ args: ['header', { static: false }]
1053
+ }], loading_template: [{
1054
+ type: ContentChild,
1055
+ args: ['loading', { static: false }]
1056
+ }], onSelectionChanged: [{
1057
+ type: Output
1058
+ }], onSeriesClicked: [{
1059
+ type: Output
1060
+ }], onLoadStart: [{
1061
+ type: Output
1062
+ }], onLoadEnd: [{
1063
+ type: Output
1064
+ }] } });
1065
+
1066
+ /**
1067
+ * Classe il cui unico scopo è gestire il setup e rendering di un LineChart
1068
+ */
1069
+ class LineChartService {
1070
+ /** @ignore */
1071
+ constructor(Adapter, dateExts) {
1072
+ this.Adapter = Adapter;
1073
+ this.dateExts = dateExts;
1074
+ /** @ignore */
1075
+ this.DataGroupBucketSize = 1500;
1076
+ /** @ignore */
1077
+ this.OpacityOnSelected = 0.3;
1078
+ //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
1079
+ //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
1080
+ /** @ignore */
1081
+ this.executionTimers = {};
1082
+ }
1083
+ /**
1084
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un LineChart
1085
+ */
1086
+ graphicate(data, settings) {
1087
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1088
+ let threshold = settings.DataGroupingThreshold ?? 3000;
1089
+ let singleDataSet = settings.MergeDatasets ?? false;
1090
+ let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
1091
+ let dataShouldBeGrouped = Math.max(...dataConverted.series.map(t => t.values.length)) > threshold;
1092
+ let showTimeline = settings.Timeline || dataShouldBeGrouped;
1093
+ let seriesWithInterval = dataConverted.series.some(t => t.interval);
1094
+ let interval = seriesWithInterval ? dataConverted.series.find(t => t.interval).interval : null;
1095
+ let gapsAllowed = settings?.AllowGaps == null ? seriesWithInterval : settings?.AllowGaps;
1096
+ let finalInstant = settings?.FinalInstants ?? true;
1097
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1098
+ am4core.options.autoDispose = true;
1099
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1100
+ let ChartInstanceCasted = this.ChartInstance;
1101
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1102
+ if (settings.YAxisTitle) {
1103
+ yAxis.title.text = settings.YAxisTitle;
1104
+ yAxis.title.fontWeight = "bold";
1105
+ }
1106
+ if (settings.Min)
1107
+ yAxis.min = settings.Min;
1108
+ if (settings.Max)
1109
+ yAxis.max = settings.Max;
1110
+ if (dataConverted.limit) {
1111
+ if (dataConverted.limit.upper != null && dataConverted.limit.upper != undefined) {
1112
+ let range = yAxis.axisRanges.create();
1113
+ range.value = dataConverted.limit.upper;
1114
+ range.label.inside = true;
1115
+ range.label.text = dataConverted.limit.upperLabel;
1116
+ range.label.fill = range.grid.stroke;
1117
+ range.label.verticalCenter = "bottom";
1118
+ range.label.stroke = am4core.color(dataConverted.limit.upperColor || "#F92200");
1119
+ range.grid.stroke = am4core.color(dataConverted.limit.upperColor || "#F92200");
1120
+ range.grid.strokeWidth = 2;
1121
+ range.grid.strokeOpacity = 1;
1122
+ }
1123
+ if (dataConverted.limit.lower != null && dataConverted.limit.lower != undefined) {
1124
+ let range = yAxis.axisRanges.create();
1125
+ range.value = dataConverted.limit.lower;
1126
+ range.label.inside = true;
1127
+ range.label.text = dataConverted.limit.lowerLabel;
1128
+ range.label.fill = range.grid.stroke;
1129
+ range.label.verticalCenter = "bottom";
1130
+ range.label.stroke = am4core.color(dataConverted.limit.lowerColor || "#F92200");
1131
+ range.grid.stroke = am4core.color(dataConverted.limit.lowerColor || "#F92200");
1132
+ range.grid.strokeWidth = 2;
1133
+ range.grid.strokeOpacity = 1;
1134
+ }
1135
+ }
1136
+ let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
1137
+ if (settings.XAxisTitle) {
1138
+ dateAxis.title.text = settings.XAxisTitle;
1139
+ dateAxis.title.fontWeight = "bold";
1140
+ }
1141
+ if (showTicks) {
1142
+ dateAxis.renderer.ticks.template.disabled = false;
1143
+ dateAxis.renderer.ticks.template.strokeOpacity = 1;
1144
+ dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
1145
+ dateAxis.renderer.ticks.template.strokeWidth = 2;
1146
+ dateAxis.renderer.ticks.template.length = 10;
1147
+ dateAxis.renderer.ticks.template.location = 0;
1148
+ }
1149
+ dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
1150
+ dateAxis.renderer.grid.template.location = 0;
1151
+ dateAxis.minZoomCount = 5;
1152
+ dateAxis.groupData = dataShouldBeGrouped;
1153
+ dateAxis.groupCount = settings.DataGroupBucketSize ?? this.DataGroupBucketSize;
1154
+ //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
1155
+ if (gapsAllowed) {
1156
+ if (!seriesWithInterval) {
1157
+ console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
1158
+ return null;
1159
+ }
1160
+ dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
1161
+ }
1162
+ if (showTimeline)
1163
+ ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
1164
+ let seriesToPush = [];
1165
+ let seriesColors = [];
1166
+ let defaultIndex = 0;
1167
+ //-- Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
1168
+ if (singleDataSet) {
1169
+ let dto = {};
1170
+ dataConverted.series.forEach((vs, index) => {
1171
+ for (let i = 0; i < vs.values.length; i++) {
1172
+ var dataitem = vs.values[i];
1173
+ var indexer = new Date(dataitem.d).valueOf();
1174
+ if (!dto[indexer])
1175
+ dto[indexer] = {};
1176
+ dto[indexer]['v' + index] = dataitem.v;
1177
+ }
1178
+ });
1179
+ var dates = Object.keys(dto);
1180
+ let singleDS = [];
1181
+ for (let i = 0; i < dates.length; i++) {
1182
+ let values = dto[dates[i]];
1183
+ let item = { d: new Date(parseInt(dates[i])) };
1184
+ var vals = Object.keys(values);
1185
+ for (let ii = 0; ii < vals.length; ii++) {
1186
+ let series = vals[ii];
1187
+ let singleVal = values[series];
1188
+ item[series] = singleVal;
1189
+ }
1190
+ singleDS.push(item);
1191
+ }
1192
+ this.ChartInstance.data = singleDS;
1193
+ dateAxis.cursorTooltipEnabled = false;
1194
+ }
1195
+ //-- Fine generazione
1196
+ dataConverted.series.forEach((s, index) => {
1197
+ if (s.values[0] && !(s.values[0].d instanceof Date)) {
1198
+ for (let v = 0; v < s.values.length; v++)
1199
+ s.values[v].d = new Date(s.values[v].d);
1200
+ }
1201
+ var correctOrder = true;
1202
+ var prevDate = null;
1203
+ for (let v = 0; v < s.values.length; v++) {
1204
+ if (!prevDate)
1205
+ prevDate = s.values[v].d;
1206
+ else if (s.values[v].d < prevDate) {
1207
+ correctOrder = false;
1208
+ break;
1209
+ }
1210
+ }
1211
+ if (!correctOrder)
1212
+ s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
1213
+ let fill = s.fill != null && s.fill != undefined ? s.fill : (settings?.Fill ?? false);
1214
+ let series = settings?.Step ? new am4charts.StepLineSeries() : new am4charts.LineSeries();
1215
+ series.dataFields.valueY = "v" + (singleDataSet ? index : "");
1216
+ series.dataFields.dateX = "d";
1217
+ series.dataFields.measureUnit = s.uom;
1218
+ series.name = s.name;
1219
+ series.strokeWidth = settings?.StrokeSize ?? 1;
1220
+ series.connect = !gapsAllowed;
1221
+ series.minBulletDistance = 10;
1222
+ series.tooltipText = singleDataSet ? "" : "{name}: [bold]{valueY}[/]";
1223
+ series.tooltip.pointerOrientation = "vertical";
1224
+ series.tooltip.background.fillOpacity = 0.5;
1225
+ series.tooltip.label.padding(12, 12, 12, 12);
1226
+ series.fillOpacity = fill ? 1 : 0.0001;
1227
+ series.stacked = fill;
1228
+ //Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
1229
+ //altrimenti assegno i dati della serie direttamente alla serie
1230
+ if (singleDataSet) {
1231
+ series.tooltip.getFillFromObject = false;
1232
+ series.tooltip.background.fill = am4core.color("#eee");
1233
+ series.tooltip.label.fill = am4core.color("#00");
1234
+ series.tooltip.defaultState.transitionDuration = 0;
1235
+ series.tooltip.hiddenState.transitionDuration = 0;
1236
+ //Utilizzo il mio dateService per la formattazione della data in modo che non debba mai gestire n formati fra n librerie... bellissimo
1237
+ series.dateFormatter.format = (source) => {
1238
+ if (interval && finalInstant) {
1239
+ let timepart = null;
1240
+ switch (interval.timeunit) {
1241
+ case "hour":
1242
+ timepart = 'day';
1243
+ break;
1244
+ case "minute":
1245
+ timepart = 'hour';
1246
+ break;
1247
+ case "second":
1248
+ timepart = 'minute';
1249
+ break;
1250
+ }
1251
+ if (timepart)
1252
+ return this.dateExts.adjustDateToFinalInstant(source, timepart, interval ? interval.timeunit == "second" : false);
1253
+ }
1254
+ else
1255
+ return this.dateExts.getFormatted(source, false, interval ? interval.timeunit == "second" : false);
1256
+ };
1257
+ series.adapter.add("tooltipText", () => {
1258
+ var text = "[bold]{dateX.formatDate()}[/]\n";
1259
+ this.ChartInstance.series.each((item) => {
1260
+ let uom = " [font-style: italic]" + series.dataFields.measureUnit || "" + "[/]";
1261
+ text += "[" + item.stroke.hex + "]●[/] " + item.name + ": [bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
1262
+ });
1263
+ return text;
1264
+ });
1265
+ }
1266
+ else
1267
+ series.data = s.values;
1268
+ let segment = series.segments.template;
1269
+ let hoverState = segment.states.create("hover");
1270
+ hoverState.properties.strokeWidth = (settings?.StrokeSize ?? 1) + 1;
1271
+ let dimmed = segment.states.create("dimmed");
1272
+ dimmed.properties.stroke = am4core.color("#dadada");
1273
+ //Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
1274
+ if (s.color)
1275
+ seriesColors.push(am4core.color(s.color));
1276
+ else {
1277
+ seriesColors.push(ChartInstanceCasted.colors.list[defaultIndex % ChartInstanceCasted.colors.list.length]);
1278
+ defaultIndex++;
1279
+ }
1280
+ seriesToPush.push(series);
1281
+ });
1282
+ ChartInstanceCasted.colors.list = seriesColors;
1283
+ //Scrivo le serie nel grafico
1284
+ seriesToPush.forEach(s => {
1285
+ ChartInstanceCasted.series.push(s);
1286
+ if (showTimeline)
1287
+ ChartInstanceCasted.scrollbarX.series.push(s);
1288
+ });
1289
+ if (settings.Legend) {
1290
+ this.ChartInstance.legend = new am4charts.Legend();
1291
+ this.ChartInstance.legend.position = settings?.LegendPosition ?? 'right';
1292
+ this.ChartInstance.legend.scrollable = true;
1293
+ this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
1294
+ this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
1295
+ this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
1296
+ if (settings.LegendPadding) {
1297
+ let template = this.ChartInstance.legend.itemContainers.template;
1298
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1299
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1300
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1301
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1302
+ }
1303
+ }
1304
+ this.ChartInstance.cursor = new am4charts.XYCursor();
1305
+ //Prove******************************************************************************************************************************
1306
+ // this.ChartInstance.cursor.events.on("cursorpositionchanged", (ev) => {
1307
+ // //var value = dateAxis.positionToDate(dateAxis.toAxisPosition(ev.target.xPosition));
1308
+ // var dt = dateAxis.series.values.find(t => t.dataItem.values.dateX);
1309
+ // if (dt && dt.dataItem) {
1310
+ // console.log(dt.dataItem.values);
1311
+ // // this.ChartInstance.tooltipText = dt;
1312
+ // }
1313
+ // else {
1314
+ // this.ChartInstance.tooltipText = "";
1315
+ // }
1316
+ // });
1317
+ //******************************************************************************************************************************
1318
+ this.ChartInstance.cursor.xAxis = dateAxis;
1319
+ this.ChartInstance.cursor.yAxis = yAxis;
1320
+ if (singleDataSet)
1321
+ this.ChartInstance.cursor.maxTooltipDistance = -1;
1322
+ //TODO: Cercare di capire perché è figlio di puttana......
1323
+ dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
1324
+ dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1325
+ return this;
1326
+ }
1327
+ /** @ignore */
1328
+ refreshData(data) {
1329
+ //TODO:IMPL
1330
+ }
1331
+ /** @ignore */
1332
+ emitSelectionChanged(ev, settings) {
1333
+ if (settings.OnSelectionChangedCallback) {
1334
+ this.throttla("selchange", () => {
1335
+ var axis = ev.target;
1336
+ var start = new Date(axis.minZoomed);
1337
+ var end = new Date(axis.maxZoomed);
1338
+ var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
1339
+ settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
1340
+ }, 150);
1341
+ }
1342
+ }
1343
+ /** @ignore */
1344
+ processOver(hoveredSeries) {
1345
+ hoveredSeries.toFront();
1346
+ let fill = hoveredSeries.stacked;
1347
+ hoveredSeries.segments.each((segment) => {
1348
+ segment.setState("hover");
1349
+ if (!fill)
1350
+ segment.fillSprite.fillOpacity = this.OpacityOnSelected;
1351
+ });
1352
+ if (!fill)
1353
+ hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
1354
+ this.ChartInstance.series.each((series) => {
1355
+ if (series != hoveredSeries) {
1356
+ let fill = series.stacked;
1357
+ series.segments.each((segment) => {
1358
+ segment.setState("dimmed");
1359
+ if (!fill)
1360
+ segment.fillSprite.fillOpacity = 0;
1361
+ });
1362
+ }
1363
+ });
1364
+ }
1365
+ /** @ignore */
1366
+ processOut() {
1367
+ this.ChartInstance.series.each((series) => {
1368
+ let fill = series.stacked;
1369
+ series.segments.each((segment) => {
1370
+ segment.setState("default");
1371
+ if (!fill)
1372
+ segment.fillSprite.fillOpacity = 0;
1373
+ });
1374
+ if (!fill)
1375
+ series.legendDataItem.marker.children.getIndex(1).fillOpacity = 0;
1376
+ });
1377
+ }
1378
+ /** @ignore */
1379
+ throttla(id, func, throttleTime) {
1380
+ //Se ho la funzione che vuole eseguire ripulisco quel timeout
1381
+ if (this.executionTimers[id])
1382
+ clearTimeout(this.executionTimers[id]);
1383
+ //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
1384
+ this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
1385
+ }
1386
+ }
1387
+
1388
+ /**
1389
+ * Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
1390
+ */
1391
+ class AreaChartService {
1392
+ /** @ignore */
1393
+ constructor(Adapter) {
1394
+ this.Adapter = Adapter;
1395
+ //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
1396
+ //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
1397
+ /** @ignore */
1398
+ this.executionTimers = {};
1399
+ }
1400
+ /**
1401
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
1402
+ */
1403
+ graphicate(data, settings) {
1404
+ if (settings.Timeline) {
1405
+ console.error("Timeline not supported for area chart");
1406
+ return null;
1407
+ }
1408
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
1409
+ let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
1410
+ let interval = dataConverted.interval;
1411
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1412
+ am4core.options.autoDispose = true;
1413
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1414
+ let ChartInstanceCasted = this.ChartInstance;
1415
+ if (settings.Legend) {
1416
+ ChartInstanceCasted.legend = new am4charts.Legend();
1417
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1418
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1419
+ if (settings.LegendPadding) {
1420
+ let template = this.ChartInstance.legend.itemContainers.template;
1421
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1422
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1423
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1424
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1425
+ }
1426
+ }
1427
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1428
+ yAxis.tooltip.disabled = true;
1429
+ if (settings.YAxisTitle) {
1430
+ yAxis.title.text = settings.YAxisTitle;
1431
+ yAxis.title.fontWeight = "bold";
1432
+ }
1433
+ yAxis.min = 0;
1434
+ let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
1435
+ dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
1436
+ dateAxis.startLocation = 0.5;
1437
+ dateAxis.endLocation = 0.5;
1438
+ if (settings.XAxisTitle) {
1439
+ dateAxis.title.text = settings.XAxisTitle;
1440
+ dateAxis.title.fontWeight = "bold";
1441
+ }
1442
+ if (showTicks) {
1443
+ dateAxis.renderer.ticks.template.disabled = false;
1444
+ dateAxis.renderer.ticks.template.strokeOpacity = 1;
1445
+ dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
1446
+ dateAxis.renderer.ticks.template.strokeWidth = 2;
1447
+ dateAxis.renderer.ticks.template.length = 10;
1448
+ dateAxis.renderer.ticks.template.location = 0;
1449
+ }
1450
+ if (!!interval)
1451
+ dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
1452
+ // Unisco il dataset e tiro fuori i dati
1453
+ let chartData = [];
1454
+ let seriesToMakeCache = {};
1455
+ let seriesToMake = [];
1456
+ for (let i = 0; i < dataConverted.groups.length; i++) {
1457
+ let group = dataConverted.groups[i];
1458
+ let dataItem = { date: group.name };
1459
+ for (let ii = 0; ii < group.values.length; ii++) {
1460
+ let val = group.values[ii];
1461
+ dataItem[val.k] = val.v;
1462
+ if (!seriesToMakeCache[val.k]) {
1463
+ seriesToMakeCache[val.k] = true;
1464
+ seriesToMake.push(val.k);
1465
+ }
1466
+ }
1467
+ chartData.push(dataItem);
1468
+ }
1469
+ ChartInstanceCasted.data = chartData;
1470
+ //---------------------------------------------------------
1471
+ seriesToMake.forEach(s => { this.createSeries(ChartInstanceCasted, s); });
1472
+ ChartInstanceCasted.cursor = new am4charts.XYCursor();
1473
+ ChartInstanceCasted.cursor.xAxis = dateAxis;
1474
+ dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
1475
+ dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1476
+ return this;
1477
+ }
1478
+ /** @ignore */
1479
+ refreshData(data) {
1480
+ //TODO:IMPL
1481
+ }
1482
+ /** @ignore */
1483
+ emitSelectionChanged(ev, settings) {
1484
+ if (settings.OnSelectionChangedCallback) {
1485
+ this.throttla("selchange", () => {
1486
+ var axis = ev.target;
1487
+ var start = new Date(axis.minZoomed);
1488
+ var end = new Date(axis.maxZoomed);
1489
+ var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
1490
+ settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
1491
+ }, 150);
1492
+ }
1493
+ }
1494
+ /** @ignore */
1495
+ createSeries(chart, name) {
1496
+ let series = chart.series.push(new am4charts.LineSeries());
1497
+ series.dataFields.dateX = "date";
1498
+ series.name = name[0].toUpperCase() + name.slice(1);
1499
+ series.dataFields.valueY = name;
1500
+ series.tooltipText = "[#000]{valueY.value}[/]";
1501
+ //series.tooltip.background.fill = am4core.color("#FFF");
1502
+ series.tooltip.getStrokeFromObject = true;
1503
+ series.tooltip.background.strokeWidth = 3;
1504
+ series.tooltip.getFillFromObject = false;
1505
+ series.fillOpacity = 0.6;
1506
+ series.strokeWidth = 2;
1507
+ series.stacked = true;
1508
+ return series;
1509
+ }
1510
+ /** @ignore */
1511
+ throttla(id, func, throttleTime) {
1512
+ //Se ho la funzione che vuole eseguire ripulisco quel timeout
1513
+ if (this.executionTimers[id])
1514
+ clearTimeout(this.executionTimers[id]);
1515
+ //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
1516
+ this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
1517
+ }
1518
+ }
1519
+
1520
+ /**
1521
+ * Classe il cui unico scopo è gestire il setup e rendering di un PieChart
1522
+ */
1523
+ class PieChartService {
1524
+ /** @ignore */
1525
+ constructor(Adapter) {
1526
+ this.Adapter = Adapter;
1527
+ /** @ignore */
1528
+ this.ViewAbsoluteValues = true;
1529
+ }
1530
+ /**
1531
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un PieChart
1532
+ */
1533
+ graphicate(data, settings) {
1534
+ if (settings.Timeline) {
1535
+ console.error("Timeline not supported for pie chart");
1536
+ return null;
1537
+ }
1538
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1539
+ am4core.options.autoDispose = true;
1540
+ this.ChartInstance = am4core.create(settings.Name, settings.Mode3D ? am4charts.PieChart3D : am4charts.PieChart);
1541
+ this.ChartInstance.innerRadius = ((settings.DonutRadiusPercentage || 15) / 100) * settings.ContainerHeight;
1542
+ let series = this.ChartInstance.series.push(settings.Mode3D ? new am4charts.PieSeries3D() : new am4charts.PieSeries());
1543
+ series.dataFields.value = "v";
1544
+ series.dataFields.category = "k";
1545
+ //Il default sono valori percentuali
1546
+ if (this.ViewAbsoluteValues) {
1547
+ series.legendSettings.valueText = "{value}";
1548
+ series.labels.template.text = "{category}: [bold]{value}[/]";
1549
+ }
1550
+ series.slices.template.stroke = am4core.color("#fff");
1551
+ series.slices.template.strokeOpacity = 1;
1552
+ series.slices.template.togglable = false;
1553
+ series.hiddenState.properties.opacity = 1;
1554
+ series.hiddenState.properties.endAngle = -90;
1555
+ series.hiddenState.properties.startAngle = -90;
1556
+ if (settings.HideZeroes == null ? true : settings.HideZeroes) {
1557
+ series.ticks.template.events.on("ready", this.hideZeroes);
1558
+ series.ticks.template.events.on("visibilitychanged", this.hideZeroes);
1559
+ series.labels.template.events.on("ready", this.hideZeroes);
1560
+ series.labels.template.events.on("visibilitychanged", this.hideZeroes);
1561
+ }
1562
+ series.slices.template.events.on("hit", (ev) => {
1563
+ if (settings.OnSeriesClickCallback) {
1564
+ let clickedSeries = ev.target.dataItem.dataContext.k;
1565
+ settings.OnSeriesClickCallback(clickedSeries);
1566
+ }
1567
+ });
1568
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForPieChart(data) : data;
1569
+ let defaultIndex = 0;
1570
+ for (let i = 0; i < dataConverted.values.length; i++) {
1571
+ if (!dataConverted.values[i].c) {
1572
+ dataConverted.values[i].c = this.ChartInstance.colors.list[defaultIndex % this.ChartInstance.colors.list.length];
1573
+ defaultIndex++;
1574
+ }
1575
+ else
1576
+ dataConverted.values[i].c = am4core.color(dataConverted.values[i].c);
1577
+ }
1578
+ series.slices.template.propertyFields.fill = "c";
1579
+ this.ChartInstance.data = dataConverted.values;
1580
+ if (!settings.LabelsVisible) {
1581
+ series.labels.template.disabled = true;
1582
+ series.ticks.template.disabled = true;
1583
+ }
1584
+ else if (settings.LabelsWrap || settings.LabelsTruncate) {
1585
+ series.labels.template.maxWidth = settings.LabelsWidth || 100;
1586
+ if (settings.LabelsWrap)
1587
+ series.labels.template.wrap = true;
1588
+ else if (settings.LabelsTruncate)
1589
+ series.labels.template.truncate = true;
1590
+ }
1591
+ if (settings.Legend) {
1592
+ let legend = new am4charts.Legend();
1593
+ this.ChartInstance.legend = legend;
1594
+ legend.position = settings?.LegendPosition || "bottom";
1595
+ legend.itemContainers.template.togglable = settings.HideSeriesOnLabelClick === true;
1596
+ legend.itemContainers.template.tooltipText = "{category}";
1597
+ //Se la legenda non fa il toggle della serie la considero come se fosse un click sulla serie in se
1598
+ if (!settings.HideSeriesOnLabelClick) {
1599
+ legend.itemContainers.template.events.on("hit", (ev) => {
1600
+ if (settings.OnSeriesClickCallback) {
1601
+ let clickedSeries = ev.target.dataItem.dataContext.legendDataItem.name;
1602
+ settings.OnSeriesClickCallback(clickedSeries);
1603
+ }
1604
+ });
1605
+ }
1606
+ if (settings.LegendPadding) {
1607
+ let template = this.ChartInstance.legend.itemContainers.template;
1608
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1609
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1610
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1611
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1612
+ }
1613
+ }
1614
+ return this;
1615
+ }
1616
+ /** @ignore */
1617
+ refreshData(data) {
1618
+ //TODO:IMPL
1619
+ }
1620
+ /** @ignore */
1621
+ hideZeroes(ev) {
1622
+ if (ev.target.dataItem && (ev.target.dataItem.values.value.percent == 0))
1623
+ ev.target.hide();
1624
+ else
1625
+ ev.target.show();
1626
+ }
1627
+ }
1628
+
1629
+ /**
1630
+ * Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
1631
+ */
1632
+ class Vertical2DChartService {
1633
+ /** @ignore */
1634
+ constructor(Adapter) {
1635
+ this.Adapter = Adapter;
1636
+ /** @ignore */
1637
+ this.DefaultGroupPaddingPercentage = 5;
1638
+ /** @ignore */
1639
+ this.dangerZone = 50;
1640
+ /** @ignore */
1641
+ this.LabelWidth = 150;
1642
+ /** @ignore */
1643
+ this.LabelRightWhenCompressed = 20;
1644
+ /** @ignore */
1645
+ this.LabelTopWhenCompressed = -5;
1646
+ /** @ignore */
1647
+ this.DefaultColumnWidthPercentage = 85;
1648
+ }
1649
+ /**
1650
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un Vertical2DChart
1651
+ */
1652
+ graphicate(data, settings) {
1653
+ if (settings.Timeline) {
1654
+ console.error("Timeline not supported for vertical chart");
1655
+ return null;
1656
+ }
1657
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1658
+ am4core.options.autoDispose = true;
1659
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1660
+ let ChartInstanceCasted = this.ChartInstance;
1661
+ if (settings.Legend) {
1662
+ ChartInstanceCasted.legend = new am4charts.Legend();
1663
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1664
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1665
+ if (settings.LegendPadding) {
1666
+ let template = this.ChartInstance.legend.itemContainers.template;
1667
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1668
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1669
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1670
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1671
+ }
1672
+ }
1673
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1674
+ if (settings.YAxisTitle) {
1675
+ yAxis.title.text = settings.YAxisTitle;
1676
+ yAxis.title.fontWeight = "bold";
1677
+ }
1678
+ let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
1679
+ if (settings.XAxisTitle) {
1680
+ categoryAxis.title.text = settings.XAxisTitle;
1681
+ categoryAxis.title.fontWeight = "bold";
1682
+ }
1683
+ yAxis.min = 0;
1684
+ categoryAxis.dataFields.category = 'key';
1685
+ categoryAxis.renderer.cellStartLocation = am4core.percent(settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage).value;
1686
+ categoryAxis.renderer.cellEndLocation = am4core.percent(100 - (settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage)).value;
1687
+ categoryAxis.renderer.grid.template.location = 0;
1688
+ categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1689
+ let label = categoryAxis.renderer.labels.template;
1690
+ label.truncate = true;
1691
+ label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1692
+ label.tooltipText = "{category}";
1693
+ if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1694
+ categoryAxis.events.on("sizechanged", (ev) => {
1695
+ let axis = ev.target;
1696
+ var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1697
+ if (cellWidth < axis.renderer.labels.template.maxWidth) {
1698
+ let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1699
+ axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1700
+ axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1701
+ axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1702
+ axis.renderer.labels.template.horizontalCenter = "right";
1703
+ axis.renderer.labels.template.verticalCenter = "middle";
1704
+ }
1705
+ else {
1706
+ axis.renderer.labels.template.rotation = 0;
1707
+ axis.renderer.labels.template.dx = 0;
1708
+ axis.renderer.labels.template.dy = 0;
1709
+ axis.renderer.labels.template.horizontalCenter = "middle";
1710
+ axis.renderer.labels.template.verticalCenter = "top";
1711
+ }
1712
+ });
1713
+ }
1714
+ let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVertical2DChart(data) : data;
1715
+ let dataConverted = [];
1716
+ for (let i = 0; i < dataPreConverted.groups.length; i++) {
1717
+ let item = dataPreConverted.groups[i];
1718
+ let obj = { key: item.name };
1719
+ for (let p = 0; p < item.values.length; p++) {
1720
+ let value = item.values[p];
1721
+ obj[value.k] = value.v;
1722
+ }
1723
+ dataConverted.push(obj);
1724
+ }
1725
+ ChartInstanceCasted.data = dataConverted;
1726
+ if (dataPreConverted.colorInfos)
1727
+ ChartInstanceCasted.colors.list = dataPreConverted.colorInfos.map(c => am4core.color(c.color));
1728
+ //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
1729
+ for (let prop in dataConverted[0])
1730
+ if (prop !== "key")
1731
+ this.createSeries(ChartInstanceCasted, settings, prop, prop);
1732
+ return this;
1733
+ }
1734
+ /** @ignore */
1735
+ refreshData(data) {
1736
+ //TODO:IMPL
1737
+ }
1738
+ /** @ignore */
1739
+ createSeries(chart, settings, value, name) {
1740
+ let series = chart.series.push(new am4charts.ColumnSeries());
1741
+ series.dataFields.valueY = value;
1742
+ series.dataFields.categoryX = 'key';
1743
+ series.name = name;
1744
+ series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
1745
+ series.columns.template.fillOpacity = .8;
1746
+ series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
1747
+ series.events.on("hidden", () => this.arrangeColumns);
1748
+ series.events.on("shown", () => this.arrangeColumns);
1749
+ return series;
1750
+ }
1751
+ /** @ignore */
1752
+ arrangeColumns() {
1753
+ let ChartInstanceCasted = this.ChartInstance;
1754
+ let series = ChartInstanceCasted.series.getIndex(0);
1755
+ let xAxis = ChartInstanceCasted.xAxes.getIndex(0);
1756
+ let w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
1757
+ if (series.dataItems.length > 1) {
1758
+ let x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
1759
+ let x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
1760
+ let delta = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
1761
+ if (am4core.isNumber(delta)) {
1762
+ let middle = ChartInstanceCasted.series.length / 2;
1763
+ let newIndex = 0;
1764
+ ChartInstanceCasted.series.each((series) => {
1765
+ if (!series.isHidden && !series.isHiding) {
1766
+ series.dummyData = newIndex;
1767
+ newIndex++;
1768
+ }
1769
+ else {
1770
+ series.dummyData = ChartInstanceCasted.series.indexOf(series);
1771
+ }
1772
+ });
1773
+ let visibleCount = newIndex;
1774
+ let newMiddle = visibleCount / 2;
1775
+ ChartInstanceCasted.series.each((series) => {
1776
+ let trueIndex = ChartInstanceCasted.series.indexOf(series);
1777
+ let newIndex = series.dummyData;
1778
+ let dx = (newIndex - trueIndex + middle - newMiddle) * delta;
1779
+ series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1780
+ series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1781
+ });
1782
+ }
1783
+ }
1784
+ }
1785
+ }
1786
+
1787
+ /**
1788
+ * Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
1789
+ */
1790
+ class VerticalChartService {
1791
+ /** @ignore */
1792
+ constructor(Adapter) {
1793
+ this.Adapter = Adapter;
1794
+ /** @ignore */
1795
+ this.dangerZone = 50;
1796
+ /** @ignore */
1797
+ this.LabelWidth = 150;
1798
+ /** @ignore */
1799
+ this.LabelRightWhenCompressed = 20;
1800
+ /** @ignore */
1801
+ this.LabelTopWhenCompressed = -5;
1802
+ /** @ignore */
1803
+ this.DefaultColumnWidthPercentage = 85;
1804
+ }
1805
+ /**
1806
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
1807
+ */
1808
+ graphicate(data, settings) {
1809
+ if (settings.Timeline) {
1810
+ console.error("Timeline not supported for vertical chart");
1811
+ return null;
1812
+ }
1813
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1814
+ am4core.options.autoDispose = true;
1815
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1816
+ let ChartInstanceCasted = this.ChartInstance;
1817
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
1818
+ ChartInstanceCasted.data = dataConverted.values;
1819
+ if (settings.Legend) {
1820
+ ChartInstanceCasted.legend = new am4charts.Legend();
1821
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1822
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1823
+ if (settings.LegendPadding) {
1824
+ let template = this.ChartInstance.legend.itemContainers.template;
1825
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1826
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1827
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1828
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1829
+ }
1830
+ }
1831
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1832
+ if (settings.YAxisTitle) {
1833
+ yAxis.title.text = settings.YAxisTitle;
1834
+ yAxis.title.fontWeight = "bold";
1835
+ }
1836
+ let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
1837
+ if (settings.XAxisTitle) {
1838
+ categoryAxis.title.text = settings.XAxisTitle;
1839
+ categoryAxis.title.fontWeight = "bold";
1840
+ }
1841
+ categoryAxis.dataFields.category = "k";
1842
+ categoryAxis.renderer.grid.template.location = 0;
1843
+ categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1844
+ let label = categoryAxis.renderer.labels.template;
1845
+ label.truncate = true;
1846
+ label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1847
+ label.tooltipText = "{category}";
1848
+ if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1849
+ categoryAxis.events.on("sizechanged", (ev) => {
1850
+ let axis = ev.target;
1851
+ var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1852
+ if (cellWidth < axis.renderer.labels.template.maxWidth) {
1853
+ let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1854
+ axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1855
+ axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1856
+ axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1857
+ axis.renderer.labels.template.horizontalCenter = "right";
1858
+ axis.renderer.labels.template.verticalCenter = "middle";
1859
+ }
1860
+ else {
1861
+ axis.renderer.labels.template.rotation = 0;
1862
+ axis.renderer.labels.template.dx = 0;
1863
+ axis.renderer.labels.template.dy = 0;
1864
+ axis.renderer.labels.template.horizontalCenter = "middle";
1865
+ axis.renderer.labels.template.verticalCenter = "top";
1866
+ }
1867
+ });
1868
+ }
1869
+ // Create series
1870
+ let series = ChartInstanceCasted.series.push(new am4charts.ColumnSeries());
1871
+ series.dataFields.valueY = "v";
1872
+ series.dataFields.categoryX = "k";
1873
+ series.name = "";
1874
+ series.columns.template.tooltipText = "{categoryX}: [bold]{valueY}[/]";
1875
+ series.columns.template.fillOpacity = .8;
1876
+ series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
1877
+ let columnTemplate = series.columns.template;
1878
+ columnTemplate.strokeWidth = 2;
1879
+ columnTemplate.strokeOpacity = 1;
1880
+ return this;
1881
+ }
1882
+ /** @ignore */
1883
+ refreshData(data) {
1884
+ //TODO:IMPL
1885
+ }
1886
+ }
1887
+
1888
+ /**
1889
+ * Classe il cui unico scopo è gestire il setup e rendering di un VerticalStackedChart
1890
+ */
1891
+ class VerticalStackedChartService {
1892
+ /** @ignore */
1893
+ constructor(Adapter) {
1894
+ this.Adapter = Adapter;
1895
+ /** @ignore */
1896
+ this.dangerZone = 50;
1897
+ /** @ignore */
1898
+ this.LabelWidth = 150;
1899
+ /** @ignore */
1900
+ this.LabelRightWhenCompressed = 20;
1901
+ /** @ignore */
1902
+ this.LabelTopWhenCompressed = -5;
1903
+ /** @ignore */
1904
+ this.DefaultColumnWidthPercentage = 85;
1905
+ }
1906
+ /**
1907
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalStackedChart
1908
+ */
1909
+ graphicate(data, settings) {
1910
+ if (settings.Timeline) {
1911
+ console.error("Timeline not supported for vertical chart");
1912
+ return null;
1913
+ }
1914
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1915
+ am4core.options.autoDispose = true;
1916
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1917
+ let ChartInstanceCasted = this.ChartInstance;
1918
+ // Create axes
1919
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1920
+ if (settings.YAxisTitle) {
1921
+ yAxis.title.text = settings.YAxisTitle;
1922
+ yAxis.title.fontWeight = "bold";
1923
+ }
1924
+ let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
1925
+ if (settings.XAxisTitle) {
1926
+ categoryAxis.title.text = settings.XAxisTitle;
1927
+ categoryAxis.title.fontWeight = "bold";
1928
+ }
1929
+ yAxis.min = 0;
1930
+ categoryAxis.dataFields.category = "key";
1931
+ categoryAxis.renderer.grid.template.location = 0;
1932
+ categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1933
+ let label = categoryAxis.renderer.labels.template;
1934
+ label.truncate = true;
1935
+ label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1936
+ label.tooltipText = "{category}";
1937
+ if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1938
+ categoryAxis.events.on("sizechanged", (ev) => {
1939
+ let axis = ev.target;
1940
+ var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1941
+ if (cellWidth < axis.renderer.labels.template.maxWidth) {
1942
+ let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1943
+ axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1944
+ axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1945
+ axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1946
+ axis.renderer.labels.template.horizontalCenter = "right";
1947
+ axis.renderer.labels.template.verticalCenter = "middle";
1948
+ }
1949
+ else {
1950
+ axis.renderer.labels.template.rotation = 0;
1951
+ axis.renderer.labels.template.dx = 0;
1952
+ axis.renderer.labels.template.dy = 0;
1953
+ axis.renderer.labels.template.horizontalCenter = "middle";
1954
+ axis.renderer.labels.template.verticalCenter = "top";
1955
+ }
1956
+ });
1957
+ }
1958
+ let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVerticalStackedChart(data) : data;
1959
+ let dataConverted = [];
1960
+ for (let i = 0; i < dataPreConverted.groups.length; i++) {
1961
+ let item = dataPreConverted.groups[i];
1962
+ let obj = { key: item.name };
1963
+ for (let p = 0; p < item.values.length; p++) {
1964
+ let value = item.values[p];
1965
+ obj[value.k] = value.v;
1966
+ }
1967
+ dataConverted.push(obj);
1968
+ }
1969
+ ChartInstanceCasted.data = dataConverted;
1970
+ //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
1971
+ for (let prop in dataConverted[0]) {
1972
+ if (prop !== "key")
1973
+ this.createSeriesStacked(ChartInstanceCasted, settings, prop, prop);
1974
+ }
1975
+ if (settings.Legend) {
1976
+ ChartInstanceCasted.legend = new am4charts.Legend();
1977
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1978
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1979
+ if (settings.LegendPadding) {
1980
+ let template = this.ChartInstance.legend.itemContainers.template;
1981
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1982
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1983
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1984
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1985
+ }
1986
+ }
1987
+ return this;
1988
+ }
1989
+ /** @ignore */
1990
+ refreshData(data) {
1991
+ //TODO:IMPL
1992
+ }
1993
+ /** @ignore */
1994
+ createSeriesStacked(chart, settings, field, name) {
1995
+ // Set up series
1996
+ let series = chart.series.push(new am4charts.ColumnSeries());
1997
+ series.name = name;
1998
+ series.dataFields.valueY = field;
1999
+ series.dataFields.categoryX = "key";
2000
+ series.sequencedInterpolation = true;
2001
+ series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
2002
+ series.columns.template.fillOpacity = .8;
2003
+ series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
2004
+ // Make it stacked
2005
+ series.stacked = true;
2006
+ return series;
2007
+ }
2008
+ }
2009
+
2010
+ /**
2011
+ * Componente specifico per la graficazione di un qualsiasi tipo di grafico.
2012
+ *
2013
+ * Si basa sul tipo specificato dalla proprietà **Type**
2014
+ */
2015
+ class EsChartComponent extends BaseChartComponent {
2016
+ /**
2017
+ * @ignore
2018
+ */
2019
+ constructor(el, ChartLoader, ChartDispatcher, dateService, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2020
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2021
+ this.dateService = dateService;
2022
+ this.adapter = adapter;
2023
+ }
2024
+ /**
2025
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2026
+ */
2027
+ getSpecificPropertiesToCheck() {
2028
+ return ["Data", "Type"];
2029
+ }
2030
+ /**
2031
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2032
+ *
2033
+ * @returns {PieChartSettings | AreaChartSettings | LineChartSettings | VerticalChartSettings | Vertical2DChartSettings | VerticalStackedChartSettings} Settings castati al tipo giusto
2034
+ */
2035
+ getCastedSettings() {
2036
+ switch (this.Type) {
2037
+ case 'pie':
2038
+ return (this.Settings ?? new PieChartSettings());
2039
+ case 'area':
2040
+ return (this.Settings ?? new AreaChartSettings());
2041
+ case 'line':
2042
+ return (this.Settings ?? new LineChartSettings());
2043
+ case 'vertical':
2044
+ return (this.Settings ?? new VerticalChartSettings());
2045
+ case 'vertical-2d':
2046
+ return (this.Settings ?? new Vertical2DChartSettings());
2047
+ case 'vertical-stacked':
2048
+ return (this.Settings ?? new VerticalStackedChartSettings());
2049
+ }
2050
+ }
2051
+ /**
2052
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2053
+ *
2054
+ * @param {PieChartSettings | AreaChartSettings | LineChartSettings | VerticalChartSettings | Vertical2DChartSettings | VerticalStackedChartSettings} settingsCasted Settings castati al tipo giusto
2055
+ */
2056
+ fillSpecificSettings(settingsCasted) {
2057
+ // Nope. Se si usa l'es-chart si danno i settings con l'oggetto
2058
+ }
2059
+ /**
2060
+ * Effettua il rendering di questo grafico in base ai Settings
2061
+ *
2062
+ * @param {PieChartSettings | AreaChartSettings | LineChartSettings | VerticalChartSettings | Vertical2DChartSettings | VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
2063
+ * @returns {PieChartService | AreaChartService | LineChartService | VerticalChartService | Vertical2DChartService | VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2064
+ */
2065
+ graphicate(settings) {
2066
+ switch (this.Type) {
2067
+ case 'pie':
2068
+ return new PieChartService(this.adapter).graphicate(this.Data, settings);
2069
+ case 'area':
2070
+ return new AreaChartService(this.adapter).graphicate(this.Data, settings);
2071
+ case 'line':
2072
+ return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settings);
2073
+ case 'vertical':
2074
+ return new VerticalChartService(this.adapter).graphicate(this.Data, settings);
2075
+ case 'vertical-2d':
2076
+ return new Vertical2DChartService(this.adapter).graphicate(this.Data, settings);
2077
+ case 'vertical-stacked':
2078
+ return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settings);
2079
+ }
2080
+ }
2081
+ }
2082
+ EsChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i2.DateService }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_LOCALE }, { token: ESC_THEME }], target: i0.ɵɵFactoryTarget.Component });
2083
+ EsChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: EsChartComponent, selector: "es-chart", inputs: { Type: "Type", Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], components: [{ type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2084
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartComponent, decorators: [{
2085
+ type: Component,
2086
+ args: [{ selector: 'es-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2087
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i2.DateService }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2088
+ type: Inject,
2089
+ args: [PLATFORM_ID]
2090
+ }] }, { type: undefined, decorators: [{
2091
+ type: Inject,
2092
+ args: [ESC_LOGS]
2093
+ }] }, { type: undefined, decorators: [{
2094
+ type: Inject,
2095
+ args: [ESC_ANIMATIONS]
2096
+ }] }, { type: undefined, decorators: [{
2097
+ type: Inject,
2098
+ args: [ESC_LOCALE]
2099
+ }] }, { type: undefined, decorators: [{
2100
+ type: Inject,
2101
+ args: [ESC_THEME]
2102
+ }] }]; }, propDecorators: { Type: [{
2103
+ type: Input
2104
+ }], Data: [{
2105
+ type: Input
2106
+ }], DataArray: [{
2107
+ type: Input
2108
+ }] } });
2109
+
2110
+ /**
2111
+ * Componente specifico per la graficazione di un grafico ad Area
2112
+ */
2113
+ class EsAreaChartComponent extends BaseChartComponent {
2114
+ /**
2115
+ * @ignore
2116
+ */
2117
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2118
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2119
+ this.adapter = adapter;
2120
+ }
2121
+ /**
2122
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2123
+ */
2124
+ getSpecificPropertiesToCheck() {
2125
+ return ["Data", "DataArray"];
2126
+ }
2127
+ /**
2128
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2129
+ *
2130
+ * @returns {AreaChartSettings} Settings castati al tipo giusto
2131
+ */
2132
+ getCastedSettings() {
2133
+ return (this.Settings ?? new AreaChartSettings());
2134
+ }
2135
+ /**
2136
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2137
+ *
2138
+ * @param {AreaChartSettings} settingsCasted Settings castati al tipo giusto
2139
+ */
2140
+ fillSpecificSettings(settingsCasted) {
2141
+ }
2142
+ /**
2143
+ * Effettua il rendering di questo grafico in base ai Settings
2144
+ *
2145
+ * @param {AreaChartSettings} settingsCasted Impostazioni di graficazione
2146
+ * @returns {AreaChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2147
+ */
2148
+ graphicate(settingsCasted) {
2149
+ return new AreaChartService(this.adapter).graphicate(this.Data, settingsCasted);
2150
+ }
2151
+ }
2152
+ EsAreaChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsAreaChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_LOCALE }, { token: ESC_THEME }], target: i0.ɵɵFactoryTarget.Component });
2153
+ EsAreaChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: EsAreaChartComponent, selector: "es-area-chart", inputs: { Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], components: [{ type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsAreaChartComponent, decorators: [{
2155
+ type: Component,
2156
+ args: [{ selector: 'es-area-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2157
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2158
+ type: Inject,
2159
+ args: [PLATFORM_ID]
2160
+ }] }, { type: undefined, decorators: [{
2161
+ type: Inject,
2162
+ args: [ESC_LOGS]
2163
+ }] }, { type: undefined, decorators: [{
2164
+ type: Inject,
2165
+ args: [ESC_ANIMATIONS]
2166
+ }] }, { type: undefined, decorators: [{
2167
+ type: Inject,
2168
+ args: [ESC_LOCALE]
2169
+ }] }, { type: undefined, decorators: [{
2170
+ type: Inject,
2171
+ args: [ESC_THEME]
2172
+ }] }]; }, propDecorators: { Data: [{
2173
+ type: Input
2174
+ }], DataArray: [{
2175
+ type: Input
2176
+ }] } });
2177
+
2178
+ /**
2179
+ * Componente specifico per la graficazione di un grafico a Linea su un asse temporale
2180
+ */
2181
+ class EsLineChartComponent extends BaseChartComponent {
2182
+ /**
2183
+ * @ignore
2184
+ */
2185
+ constructor(el, ChartLoader, ChartDispatcher, adapter, dateService, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2186
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2187
+ this.adapter = adapter;
2188
+ this.dateService = dateService;
2189
+ }
2190
+ /**
2191
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2192
+ */
2193
+ getSpecificPropertiesToCheck() {
2194
+ return ["Data", "DataArray", "Step", "DataGroupBucketSize", "DataGroupingThreshold", "StrokeSize", "AllowGaps", "MergeDatasets", "FinalInstants", "Fill", "Min", "Max"];
2195
+ }
2196
+ /**
2197
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2198
+ *
2199
+ * @returns {LineChartSettings} Settings castati al tipo giusto
2200
+ */
2201
+ getCastedSettings() {
2202
+ return (this.Settings ?? new LineChartSettings());
2203
+ }
2204
+ /**
2205
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2206
+ *
2207
+ * @param {LineChartSettings} settingsCasted Settings castati al tipo giusto
2208
+ */
2209
+ fillSpecificSettings(settingsCasted) {
2210
+ settingsCasted.Step = settingsCasted.Step != null ? settingsCasted.Step : this.Step;
2211
+ settingsCasted.DataGroupBucketSize = settingsCasted.DataGroupBucketSize != null ? settingsCasted.DataGroupBucketSize : this.DataGroupBucketSize;
2212
+ settingsCasted.StrokeSize = settingsCasted.StrokeSize != null ? settingsCasted.StrokeSize : this.StrokeSize;
2213
+ settingsCasted.DataGroupingThreshold = settingsCasted.DataGroupingThreshold != null ? settingsCasted.DataGroupingThreshold : this.DataGroupingThreshold;
2214
+ settingsCasted.AllowGaps = settingsCasted.AllowGaps != null ? settingsCasted.AllowGaps : this.AllowGaps;
2215
+ settingsCasted.MergeDatasets = settingsCasted.MergeDatasets != null ? settingsCasted.MergeDatasets : this.MergeDatasets;
2216
+ settingsCasted.FinalInstants = settingsCasted.FinalInstants != null ? settingsCasted.FinalInstants : this.FinalInstants;
2217
+ settingsCasted.Min = settingsCasted.Min != null ? settingsCasted.Min : this.Min;
2218
+ settingsCasted.Max = settingsCasted.Max != null ? settingsCasted.Max : this.Max;
2219
+ settingsCasted.Fill = settingsCasted.Fill != null ? settingsCasted.Fill : this.Fill;
2220
+ }
2221
+ /**
2222
+ * Effettua il rendering di questo grafico in base ai Settings
2223
+ *
2224
+ * @param {LineChartSettings} settingsCasted Impostazioni di graficazione
2225
+ * @returns {LineChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2226
+ */
2227
+ graphicate(settingsCasted) {
2228
+ return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settingsCasted);
2229
+ }
2230
+ }
2231
+ EsLineChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsLineChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i2.DateService }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_LOCALE }, { token: ESC_THEME }], target: i0.ɵɵFactoryTarget.Component });
2232
+ EsLineChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: EsLineChartComponent, selector: "es-line-chart", inputs: { Data: "Data", DataArray: "DataArray", Step: "Step", DataGroupBucketSize: "DataGroupBucketSize", DataGroupingThreshold: "DataGroupingThreshold", StrokeSize: "StrokeSize", AllowGaps: "AllowGaps", MergeDatasets: "MergeDatasets", FinalInstants: "FinalInstants", Min: "Min", Max: "Max", Fill: "Fill" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], components: [{ type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsLineChartComponent, decorators: [{
2234
+ type: Component,
2235
+ args: [{ selector: 'es-line-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2236
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i2.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
2237
+ type: Inject,
2238
+ args: [PLATFORM_ID]
2239
+ }] }, { type: undefined, decorators: [{
2240
+ type: Inject,
2241
+ args: [ESC_LOGS]
2242
+ }] }, { type: undefined, decorators: [{
2243
+ type: Inject,
2244
+ args: [ESC_ANIMATIONS]
2245
+ }] }, { type: undefined, decorators: [{
2246
+ type: Inject,
2247
+ args: [ESC_LOCALE]
2248
+ }] }, { type: undefined, decorators: [{
2249
+ type: Inject,
2250
+ args: [ESC_THEME]
2251
+ }] }]; }, propDecorators: { Data: [{
2252
+ type: Input
2253
+ }], DataArray: [{
2254
+ type: Input
2255
+ }], Step: [{
2256
+ type: Input
2257
+ }], DataGroupBucketSize: [{
2258
+ type: Input
2259
+ }], DataGroupingThreshold: [{
2260
+ type: Input
2261
+ }], StrokeSize: [{
2262
+ type: Input
2263
+ }], AllowGaps: [{
2264
+ type: Input
2265
+ }], MergeDatasets: [{
2266
+ type: Input
2267
+ }], FinalInstants: [{
2268
+ type: Input
2269
+ }], Min: [{
2270
+ type: Input
2271
+ }], Max: [{
2272
+ type: Input
2273
+ }], Fill: [{
2274
+ type: Input
2275
+ }] } });
2276
+
2277
+ /**
2278
+ * Componente specifico per la graficazione di un grafico a Torta
2279
+ */
2280
+ class EsPieChartComponent extends BaseChartComponent {
2281
+ /**
2282
+ * @ignore
2283
+ */
2284
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2285
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2286
+ this.adapter = adapter;
2287
+ }
2288
+ /**
2289
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2290
+ */
2291
+ getSpecificPropertiesToCheck() {
2292
+ return ["Data", "DataArray", "HideZeroes", "Mode3D", "LabelsWrap", "LabelsTruncate", "LabelsWidth", "LabelsVisible"];
2293
+ }
2294
+ /**
2295
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2296
+ *
2297
+ * @returns {PieChartSettings} Settings castati al tipo giusto
2298
+ */
2299
+ getCastedSettings() {
2300
+ return (this.Settings ?? new PieChartSettings());
2301
+ }
2302
+ /**
2303
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2304
+ *
2305
+ * @param {PieChartSettings} settingsCasted Settings castati al tipo giusto
2306
+ */
2307
+ fillSpecificSettings(settingsCasted) {
2308
+ settingsCasted.HideZeroes = settingsCasted.HideZeroes != null ? settingsCasted.HideZeroes : this.HideZeroes;
2309
+ settingsCasted.Mode3D = settingsCasted.Mode3D != null ? settingsCasted.Mode3D : this.Mode3D;
2310
+ settingsCasted.DonutRadiusPercentage = settingsCasted.DonutRadiusPercentage != null ? settingsCasted.DonutRadiusPercentage : this.DonutRadiusPercentage;
2311
+ settingsCasted.LabelsWrap = settingsCasted.LabelsWrap != null ? settingsCasted.LabelsWrap : this.LabelsWrap;
2312
+ settingsCasted.LabelsTruncate = settingsCasted.LabelsTruncate != null ? settingsCasted.LabelsTruncate : this.LabelsTruncate;
2313
+ settingsCasted.LabelsWidth = settingsCasted.LabelsWidth != null ? settingsCasted.LabelsWidth : this.LabelsWidth;
2314
+ settingsCasted.LabelsVisible = settingsCasted.LabelsVisible != null ? settingsCasted.LabelsVisible : this.LabelsVisible;
2315
+ }
2316
+ /**
2317
+ * Effettua il rendering di questo grafico in base ai Settings
2318
+ *
2319
+ * @param {PieChartSettings} settingsCasted Impostazioni di graficazione
2320
+ * @returns {PieChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2321
+ */
2322
+ graphicate(settingsCasted) {
2323
+ return new PieChartService(this.adapter).graphicate(this.Data, settingsCasted);
2324
+ }
2325
+ }
2326
+ EsPieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsPieChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_LOCALE }, { token: ESC_THEME }], target: i0.ɵɵFactoryTarget.Component });
2327
+ EsPieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: EsPieChartComponent, selector: "es-pie-chart", inputs: { Data: "Data", DataArray: "DataArray", HideZeroes: "HideZeroes", Mode3D: "Mode3D", DonutRadiusPercentage: "DonutRadiusPercentage", LabelsWrap: "LabelsWrap", LabelsTruncate: "LabelsTruncate", LabelsWidth: "LabelsWidth", LabelsVisible: "LabelsVisible" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], components: [{ type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsPieChartComponent, decorators: [{
2329
+ type: Component,
2330
+ args: [{ selector: 'es-pie-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2331
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2332
+ type: Inject,
2333
+ args: [PLATFORM_ID]
2334
+ }] }, { type: undefined, decorators: [{
2335
+ type: Inject,
2336
+ args: [ESC_LOGS]
2337
+ }] }, { type: undefined, decorators: [{
2338
+ type: Inject,
2339
+ args: [ESC_ANIMATIONS]
2340
+ }] }, { type: undefined, decorators: [{
2341
+ type: Inject,
2342
+ args: [ESC_LOCALE]
2343
+ }] }, { type: undefined, decorators: [{
2344
+ type: Inject,
2345
+ args: [ESC_THEME]
2346
+ }] }]; }, propDecorators: { Data: [{
2347
+ type: Input
2348
+ }], DataArray: [{
2349
+ type: Input
2350
+ }], HideZeroes: [{
2351
+ type: Input
2352
+ }], Mode3D: [{
2353
+ type: Input
2354
+ }], DonutRadiusPercentage: [{
2355
+ type: Input
2356
+ }], LabelsWrap: [{
2357
+ type: Input
2358
+ }], LabelsTruncate: [{
2359
+ type: Input
2360
+ }], LabelsWidth: [{
2361
+ type: Input
2362
+ }], LabelsVisible: [{
2363
+ type: Input
2364
+ }] } });
2365
+
2366
+ /**
2367
+ * Componente specifico per la graficazione di un grafico a Barre con due dimensioni
2368
+ */
2369
+ class EsVertical2DChartComponent extends BaseChartComponent {
2370
+ /**
2371
+ * @ignore
2372
+ */
2373
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2374
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2375
+ this.adapter = adapter;
2376
+ }
2377
+ /**
2378
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2379
+ */
2380
+ getSpecificPropertiesToCheck() {
2381
+ return ["Data", "DataArray"];
2382
+ }
2383
+ /**
2384
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2385
+ *
2386
+ * @returns {Vertical2DChartSettings} Settings castati al tipo giusto
2387
+ */
2388
+ getCastedSettings() {
2389
+ return (this.Settings ?? new Vertical2DChartSettings());
2390
+ }
2391
+ /**
2392
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2393
+ *
2394
+ * @param {Vertical2DChartSettings} settingsCasted Settings castati al tipo giusto
2395
+ */
2396
+ fillSpecificSettings(settingsCasted) {
2397
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2398
+ settingsCasted.GroupPaddingPercentage = settingsCasted.GroupPaddingPercentage != null ? settingsCasted.GroupPaddingPercentage : this.GroupPaddingPercentage;
2399
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2400
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2401
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2402
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2403
+ }
2404
+ /**
2405
+ * Effettua il rendering di questo grafico in base ai Settings
2406
+ *
2407
+ * @param {Vertical2DChartSettings} settingsCasted Impostazioni di graficazione
2408
+ * @returns {Vertical2DChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2409
+ */
2410
+ graphicate(settingsCasted) {
2411
+ return new Vertical2DChartService(this.adapter).graphicate(this.Data, settingsCasted);
2412
+ }
2413
+ }
2414
+ EsVertical2DChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVertical2DChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_LOCALE }, { token: ESC_THEME }], target: i0.ɵɵFactoryTarget.Component });
2415
+ EsVertical2DChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: EsVertical2DChartComponent, selector: "es-vertical-2d-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", GroupPaddingPercentage: "GroupPaddingPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], components: [{ type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2416
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
2417
+ type: Component,
2418
+ args: [{ selector: 'es-vertical-2d-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2419
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2420
+ type: Inject,
2421
+ args: [PLATFORM_ID]
2422
+ }] }, { type: undefined, decorators: [{
2423
+ type: Inject,
2424
+ args: [ESC_LOGS]
2425
+ }] }, { type: undefined, decorators: [{
2426
+ type: Inject,
2427
+ args: [ESC_ANIMATIONS]
2428
+ }] }, { type: undefined, decorators: [{
2429
+ type: Inject,
2430
+ args: [ESC_LOCALE]
2431
+ }] }, { type: undefined, decorators: [{
2432
+ type: Inject,
2433
+ args: [ESC_THEME]
2434
+ }] }]; }, propDecorators: { Data: [{
2435
+ type: Input
2436
+ }], DataArray: [{
2437
+ type: Input
2438
+ }], ColumnWidthPercentage: [{
2439
+ type: Input
2440
+ }], GroupPaddingPercentage: [{
2441
+ type: Input
2442
+ }], LabelWidth: [{
2443
+ type: Input
2444
+ }], LabelVerticalOrientationCutoffWidth: [{
2445
+ type: Input
2446
+ }], LabelRightWhenCompressed: [{
2447
+ type: Input
2448
+ }], LabelTopWhenCompressed: [{
2449
+ type: Input
2450
+ }] } });
2451
+
2452
+ /**
2453
+ * Componente specifico per la graficazione di un grafico a Barre
2454
+ */
2455
+ class EsVerticalChartComponent extends BaseChartComponent {
2456
+ /**
2457
+ * @ignore
2458
+ */
2459
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2460
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2461
+ this.adapter = adapter;
2462
+ }
2463
+ /**
2464
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2465
+ */
2466
+ getSpecificPropertiesToCheck() {
2467
+ return ["Data", "DataArray"];
2468
+ }
2469
+ /**
2470
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2471
+ *
2472
+ * @returns {VerticalChartSettings} Settings castati al tipo giusto
2473
+ */
2474
+ getCastedSettings() {
2475
+ return (this.Settings ?? new VerticalChartSettings());
2476
+ }
2477
+ /**
2478
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2479
+ *
2480
+ * @param {VerticalChartSettings} settingsCasted Settings castati al tipo giusto
2481
+ */
2482
+ fillSpecificSettings(settingsCasted) {
2483
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2484
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2485
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2486
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2487
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2488
+ }
2489
+ /**
2490
+ * Effettua il rendering di questo grafico in base ai Settings
2491
+ *
2492
+ * @param {VerticalChartSettings} settingsCasted Impostazioni di graficazione
2493
+ * @returns {VerticalChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2494
+ */
2495
+ graphicate(settingsCasted) {
2496
+ return new VerticalChartService(this.adapter).graphicate(this.Data, settingsCasted);
2497
+ }
2498
+ }
2499
+ EsVerticalChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVerticalChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_LOCALE }, { token: ESC_THEME }], target: i0.ɵɵFactoryTarget.Component });
2500
+ EsVerticalChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: EsVerticalChartComponent, selector: "es-vertical-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], components: [{ type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2501
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
2502
+ type: Component,
2503
+ args: [{ selector: 'es-vertical-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2504
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2505
+ type: Inject,
2506
+ args: [PLATFORM_ID]
2507
+ }] }, { type: undefined, decorators: [{
2508
+ type: Inject,
2509
+ args: [ESC_LOGS]
2510
+ }] }, { type: undefined, decorators: [{
2511
+ type: Inject,
2512
+ args: [ESC_ANIMATIONS]
2513
+ }] }, { type: undefined, decorators: [{
2514
+ type: Inject,
2515
+ args: [ESC_LOCALE]
2516
+ }] }, { type: undefined, decorators: [{
2517
+ type: Inject,
2518
+ args: [ESC_THEME]
2519
+ }] }]; }, propDecorators: { Data: [{
2520
+ type: Input
2521
+ }], DataArray: [{
2522
+ type: Input
2523
+ }], ColumnWidthPercentage: [{
2524
+ type: Input
2525
+ }], LabelWidth: [{
2526
+ type: Input
2527
+ }], LabelVerticalOrientationCutoffWidth: [{
2528
+ type: Input
2529
+ }], LabelRightWhenCompressed: [{
2530
+ type: Input
2531
+ }], LabelTopWhenCompressed: [{
2532
+ type: Input
2533
+ }] } });
2534
+
2535
+ /**
2536
+ * Componente specifico per la graficazione di un grafico a Barre in modalità Stacked (una serie sopra l'altra)
2537
+ */
2538
+ class EsVerticalStackedChartComponent extends BaseChartComponent {
2539
+ /**
2540
+ * @ignore
2541
+ */
2542
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2543
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2544
+ this.adapter = adapter;
2545
+ }
2546
+ /**
2547
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2548
+ */
2549
+ getSpecificPropertiesToCheck() {
2550
+ return ["Data", "DataArray"];
2551
+ }
2552
+ /**
2553
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2554
+ *
2555
+ * @returns {VerticalStackedChartSettings} Settings castati al tipo giusto
2556
+ */
2557
+ getCastedSettings() {
2558
+ return (this.Settings ?? new VerticalStackedChartSettings());
2559
+ }
2560
+ /**
2561
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2562
+ *
2563
+ * @param {VerticalStackedChartSettings} settingsCasted Settings castati al tipo giusto
2564
+ */
2565
+ fillSpecificSettings(settingsCasted) {
2566
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2567
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2568
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2569
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2570
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2571
+ }
2572
+ /**
2573
+ * Effettua il rendering di questo grafico in base ai Settings
2574
+ *
2575
+ * @param {VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
2576
+ * @returns {VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2577
+ */
2578
+ graphicate(settingsCasted) {
2579
+ return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settingsCasted);
2580
+ }
2581
+ }
2582
+ EsVerticalStackedChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVerticalStackedChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_LOCALE }, { token: ESC_THEME }], target: i0.ɵɵFactoryTarget.Component });
2583
+ EsVerticalStackedChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: EsVerticalStackedChartComponent, selector: "es-vertical-stacked-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], components: [{ type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2584
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVerticalStackedChartComponent, decorators: [{
2585
+ type: Component,
2586
+ args: [{ selector: 'es-vertical-stacked-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:#9999;text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2587
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2588
+ type: Inject,
2589
+ args: [PLATFORM_ID]
2590
+ }] }, { type: undefined, decorators: [{
2591
+ type: Inject,
2592
+ args: [ESC_LOGS]
2593
+ }] }, { type: undefined, decorators: [{
2594
+ type: Inject,
2595
+ args: [ESC_ANIMATIONS]
2596
+ }] }, { type: undefined, decorators: [{
2597
+ type: Inject,
2598
+ args: [ESC_LOCALE]
2599
+ }] }, { type: undefined, decorators: [{
2600
+ type: Inject,
2601
+ args: [ESC_THEME]
2602
+ }] }]; }, propDecorators: { Data: [{
2603
+ type: Input
2604
+ }], DataArray: [{
2605
+ type: Input
2606
+ }], ColumnWidthPercentage: [{
2607
+ type: Input
2608
+ }], LabelWidth: [{
2609
+ type: Input
2610
+ }], LabelVerticalOrientationCutoffWidth: [{
2611
+ type: Input
2612
+ }], LabelRightWhenCompressed: [{
2613
+ type: Input
2614
+ }], LabelTopWhenCompressed: [{
2615
+ type: Input
2616
+ }] } });
2617
+
2618
+ /**
2619
+ * Classe che identifica i dati per un grafico generico paginato
2620
+ */
2621
+ class PagedChartData {
2622
+ /**
2623
+ * Costruttore
2624
+ *
2625
+ * @param {T} data Dati del grafico
2626
+ * @param {string} title Titolo del grafico
2627
+ * @param {Object} dataRetrieveDto Dto utilizzato per recuperare i dati di questo grafico
2628
+ * @param {Function} dataRetrieveFunction Funzione utilizzata per ottenere i dati di questo grafico
2629
+ */
2630
+ constructor(data, title, dataRetrieveDto, dataRetrieveFunction) {
2631
+ this.data = data;
2632
+ this.title = title;
2633
+ this.dataRetrieveDto = dataRetrieveDto;
2634
+ this.dataRetrieveFunction = dataRetrieveFunction;
2635
+ }
2636
+ }
2637
+
2638
+ /** Componenti esportati dal modulo */
2639
+ const COMPONENTS = [
2640
+ EsChartComponent,
2641
+ EsLineChartComponent,
2642
+ EsPieChartComponent,
2643
+ EsVertical2DChartComponent,
2644
+ EsVerticalChartComponent,
2645
+ EsVerticalStackedChartComponent,
2646
+ PageChartSelector,
2647
+ EsAreaChartComponent
2648
+ ];
2649
+ class EsChartsModule {
2650
+ static forRoot(config) {
2651
+ return {
2652
+ ngModule: EsChartsModule,
2653
+ providers: [
2654
+ { provide: ESC_LOCALE, useValue: config?.locale || 'it-IT' },
2655
+ { provide: ESC_ANIMATIONS, useValue: config?.animations == null ? true : config?.animations },
2656
+ { provide: ESC_THEME, useValue: config?.theme || 'spiritedaway' },
2657
+ { provide: ESC_LOGS, useValue: config?.debugMode == null ? false : config?.debugMode },
2658
+ { provide: BaseAdapter, useClass: config?.adapter || BaseAdapter },
2659
+ // Singleton cattiva by Ema. Verificare strade migliori
2660
+ { provide: ChartLoader, useValue: new ChartLoader(config?.debugMode == null ? false : config?.debugMode) }
2661
+ ]
2662
+ };
2663
+ }
2664
+ }
2665
+ EsChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2666
+ EsChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
2667
+ EsLineChartComponent,
2668
+ EsPieChartComponent,
2669
+ EsVertical2DChartComponent,
2670
+ EsVerticalChartComponent,
2671
+ EsVerticalStackedChartComponent,
2672
+ PageChartSelector,
2673
+ EsAreaChartComponent], imports: [CommonModule], exports: [EsChartComponent,
2674
+ EsLineChartComponent,
2675
+ EsPieChartComponent,
2676
+ EsVertical2DChartComponent,
2677
+ EsVerticalChartComponent,
2678
+ EsVerticalStackedChartComponent,
2679
+ PageChartSelector,
2680
+ EsAreaChartComponent] });
2681
+ EsChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, providers: [ChartDispatcher], imports: [[CommonModule]] });
2682
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, decorators: [{
2683
+ type: NgModule,
2684
+ args: [{
2685
+ imports: [CommonModule],
2686
+ declarations: [...COMPONENTS],
2687
+ providers: [ChartDispatcher],
2688
+ exports: [...COMPONENTS]
2689
+ }]
2690
+ }] });
2691
+
2692
+ /*
2693
+ * Public API Surface of es-charts
2694
+ */
2695
+
2696
+ /**
2697
+ * Generated bundle index. Do not edit.
2698
+ */
2699
+
2700
+ export { AreaChartData, AreaChartSettings, BaseAdapter, BaseInterval, BaseSettings, ChartThemes, DateValue, EsAreaChartComponent, EsChartComponent, EsChartsModule, EsLineChartComponent, EsPieChartComponent, EsVertical2DChartComponent, EsVerticalChartComponent, EsVerticalStackedChartComponent, KeyValue, KeyValueColor, LegendPad, Limit, LineChartData, LineChartSettings, LineSerie, PageChartSelector, PagedChartData, PieChartData, PieChartSettings, Vertical2DChartData, Vertical2DChartSettings, VerticalChartData, VerticalChartSettings, VerticalStackedChartData, VerticalStackedChartSettings };
2701
+ //# sourceMappingURL=esfaenza-es-charts.mjs.map