@esfaenza/es-charts 12.2.13 → 13.1.4

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 (97) 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 +339 -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 +356 -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 +38 -0
  55. package/fesm2015/{esfaenza-es-charts.js → esfaenza-es-charts.mjs} +530 -384
  56. package/fesm2015/esfaenza-es-charts.mjs.map +1 -0
  57. package/fesm2020/esfaenza-es-charts.mjs +2747 -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 +12 -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/lib/services/classes/LineChartService.d.ts +4 -0
  72. package/package.json +22 -10
  73. package/public-api.d.ts +2 -0
  74. package/bundles/esfaenza-es-charts.umd.js +0 -3212
  75. package/bundles/esfaenza-es-charts.umd.js.map +0 -1
  76. package/esfaenza-es-charts.metadata.json +0 -1
  77. package/esm2015/esfaenza-es-charts.js +0 -11
  78. package/esm2015/lib/adapters/classes/BaseAdapter.js +0 -47
  79. package/esm2015/lib/components/base/base-chart.component.js +0 -311
  80. package/esm2015/lib/components/chart-pager/chart-pager.component.js +0 -84
  81. package/esm2015/lib/components/specializations/es-area-chart.component.js +0 -75
  82. package/esm2015/lib/components/specializations/es-chart.component.js +0 -108
  83. package/esm2015/lib/components/specializations/es-line-chart.component.js +0 -98
  84. package/esm2015/lib/components/specializations/es-pie-chart.component.js +0 -89
  85. package/esm2015/lib/components/specializations/es-vertical-2d-chart.component.js +0 -87
  86. package/esm2015/lib/components/specializations/es-vertical-chart.component.js +0 -85
  87. package/esm2015/lib/components/specializations/es-vertical-stacked-chart.component.js +0 -85
  88. package/esm2015/lib/es-charts.module.js +0 -42
  89. package/esm2015/lib/models/core/classes/ChartDispatcher.js +0 -88
  90. package/esm2015/lib/services/classes/AreaChartService.js +0 -135
  91. package/esm2015/lib/services/classes/LineChartService.js +0 -326
  92. package/esm2015/lib/services/classes/PieChartService.js +0 -112
  93. package/esm2015/lib/services/classes/Vertical2DChartService.js +0 -163
  94. package/esm2015/lib/services/classes/VerticalChartService.js +0 -105
  95. package/esm2015/lib/services/classes/VerticalStackedChartService.js +0 -127
  96. package/esm2015/public-api.js +0 -36
  97. package/fesm2015/esfaenza-es-charts.js.map +0 -1
@@ -0,0 +1,2747 @@
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
+ * Evento lanciato al termine della creazione del grafico referenziando l'istanza nativa del grafico creato in modo da poter effettuare modifiche
802
+ * post inizializzazione lato applicativo
803
+ */
804
+ this.chartLoaded = new EventEmitter();
805
+ /**
806
+ * Serve a decidere se sarà presente l'interfaccia di paginazione
807
+ */
808
+ this.isPaged = false;
809
+ /**
810
+ * @ignore
811
+ */
812
+ this.initDone = false;
813
+ }
814
+ /**
815
+ * Metodo di inizializzazione post valorizzazione degli input, utilizzato per valorizzare correttamente le proprietà essenziali del grafico (Animazioni, Tema e Locale)
816
+ *
817
+ * Viene data priorità ai Settings (HTML), priorità secondaria agli Input diretti (Lato HTML), priorità ultima alle impostazioni globali,
818
+ * impostate in fase di import del modulo assegnando valori ai token ESC_LOCALE, ESC_ANIMATIONS, ESC_THEME
819
+ */
820
+ ngOnInit() {
821
+ // Qui servono solo le variabili da conoscere PRE-graficazione per il caricamento dei moduli lazy del grafico
822
+ this.Animations = this.Settings?.Animations != null ? this.Settings?.Animations : (this.Animations != null ? this.Animations : this.animations);
823
+ this.Theme = this.Settings?.Theme != null ? this.Settings?.Theme : (this.Theme != null ? this.Theme : this.theme);
824
+ this.Locale = this.Settings?.Locale != null ? this.Settings?.Locale : (this.Locale != null ? this.Locale : this.locale);
825
+ this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve);
826
+ this.log("Chart " + this.name + ": ngOnInit");
827
+ }
828
+ /**
829
+ * Implementazione utilizzata per controllare eventuali proprietà chiave del grafico e rigraficare tutto qualora si rivelasse necessario
830
+ *
831
+ * @param {SimpleChanges} changes Indicazione dei cambiamenti sulle proprietà del grafico. Vedere documentazione Angular in merito
832
+ */
833
+ ngOnChanges(changes) {
834
+ if (!this.initDone)
835
+ return;
836
+ this.log("Chart " + this.name + ": ngOnChanges");
837
+ let propsToCheck = ["Timeline", "Legend", "Settings", "Animations", "Theme", "Locale", ...this.getSpecificPropertiesToCheck()];
838
+ this.checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck);
839
+ }
840
+ /**
841
+ * Nel post inizializzazione, a patto che mi trovi in ambiente "browser", proseguo al caricamento del grafico sull'HTML
842
+ */
843
+ ngAfterViewInit() {
844
+ if (!this.name)
845
+ throw "a Unique name is mandatory to create a chart";
846
+ this.log("Chart " + this.name + ": ngAfterViewInit, graphicating chart outside Angular");
847
+ if (!this.isPaged)
848
+ this.dispatchLoadChart();
849
+ }
850
+ /**
851
+ * All'onDestroy scarico il grafico per liberare memoria
852
+ */
853
+ ngOnDestroy() {
854
+ if (this.Chart) {
855
+ this.log("Chart " + this.name + ": Unloading destroyed chart");
856
+ this.browserOnly(() => { this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
857
+ }
858
+ else
859
+ this.log("Chart " + this.name + ": Unloading uncreated chart component. It probably was a duplicated");
860
+ }
861
+ /**
862
+ * Registra il grafico attuale nel Dispatcher in modo che venga caricato appena possibile
863
+ */
864
+ dispatchLoadChart() {
865
+ this.browserOnly(() => {
866
+ this.Dispatcher.register(this.name, () => { return this.loadChart(); });
867
+ });
868
+ }
869
+ /**
870
+ * Il caricamento del grafico funziona nel seguente modo:
871
+ *
872
+ * 1) Caricamento del tema e delle animazioni, qualora necessari
873
+ *
874
+ * 2) Caricamento delle impostazioni specifiche e integrazione con le impostazioni generiche
875
+ *
876
+ * 3) Graficazione
877
+ *
878
+ * 4) Caricamento del locale
879
+ */
880
+ loadChart() {
881
+ this.log("Chart " + this.name + ": Start loading Modules if needed");
882
+ return Promise.all([
883
+ this.setupAmChartsThemes().then(() => {
884
+ this.log("Chart " + this.name + ": Graphicating after modules load");
885
+ var castedSettings = this.getCastedSettings();
886
+ this.fillSettings(castedSettings);
887
+ this.fillSpecificSettings(castedSettings);
888
+ this.ChartService = this.graphicate(castedSettings);
889
+ this.Chart = this.ChartService.ChartInstance;
890
+ if (!this.Chart)
891
+ this.log("Chart " + this.name + ": Could not create graph");
892
+ return this.Charter.applyLocale(this.Chart, this.Locale).then(() => { this.initDone = true; this.chartLoaded.emit(this); });
893
+ })
894
+ ]);
895
+ }
896
+ /**
897
+ * Riempimento delle impostazioni nella classe Settings. Si danno priorità ai valori già impostati nei Settings,
898
+ * integrando eventualmente con le proprietà del grafico
899
+ *
900
+ * @param {BaseSettings} settings Impostazioni base ricevute dalla specializzazione del grafico
901
+ */
902
+ fillSettings(settings) {
903
+ // Merge degli Input con i Settings, dando priorità ai Settings
904
+ settings.Theme = settings.Theme ? settings.Theme : this.Theme;
905
+ settings.Locale = settings.Locale ? settings.Locale : this.Locale;
906
+ settings.Animations = settings.Animations != null ? settings.Animations : this.Animations;
907
+ settings.Legend = settings.Legend != null ? settings.Legend : this.Legend;
908
+ settings.Name = settings.Name ? settings.Name : this.name;
909
+ settings.Timeline = settings.Timeline != null ? settings.Timeline : this.Timeline;
910
+ settings.AdaptLabelSizeAndOrientation = settings.AdaptLabelSizeAndOrientation != null ? settings.AdaptLabelSizeAndOrientation : this.AdaptLabelSizeAndOrientation;
911
+ settings.XAxisTitle = settings.XAxisTitle ? settings.XAxisTitle : this.XTitle;
912
+ settings.YAxisTitle = settings.YAxisTitle ? settings.YAxisTitle : this.YTitle;
913
+ settings.LegendPosition = settings.LegendPosition ? settings.LegendPosition : this.LegendPosition;
914
+ settings.HideSeriesOnLabelClick = settings.HideSeriesOnLabelClick != null ? settings.HideSeriesOnLabelClick : this.HideSeriesOnLabelClick;
915
+ settings.MinGridDistance = settings.MinGridDistance != null ? settings.MinGridDistance : this.MinGridDistance;
916
+ settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : this.LegendPadding ?? null;
917
+ settings.ContainerHeight = this.el.nativeElement.parentElement.offsetHeight;
918
+ settings.OnSeriesClickCallback = (series) => { this.onSeriesClicked.emit(series); };
919
+ settings.OnSelectionChangedCallback = (event) => { this.onSelectionChanged.emit({ from: event.from, to: event.to, initial: event.initial }); };
920
+ }
921
+ /**
922
+ * Controlla i cambiamenti avvenuti alle proprietà chiave e rieffettua la graficazione qualora necessario
923
+ *
924
+ * @param {SimpleChanges} changes Indicazione della modifiche avvenute nei vari Input
925
+ * @param {string[]} propsToCheck Lista degli Input da controllare per cui una modifica causa una rigraficazione
926
+ */
927
+ checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck) {
928
+ let toReGraphicate = false;
929
+ for (let i = 0; i < propsToCheck.length; i++)
930
+ toReGraphicate = toReGraphicate || (changes[propsToCheck[i]] && changes[propsToCheck[i]].currentValue);
931
+ if (toReGraphicate)
932
+ this.reloadChart();
933
+ }
934
+ /**
935
+ * Funzione che effettua un cambio di pagina per i grafici paginati. Qualora **data** fosse nullo significa che è iniziato un caricamento
936
+ * e anche lato applicativo il DataRetrieve dovrà considerare che l'assenza di valori non è altro che un'indicazione di inizio caricamento
937
+ *
938
+ * Il caricamento di qualsiasi pagina genererà comunque una primo evento con **data** nullo in modo da indicare l'inizio caricamento e
939
+ * 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
940
+ * veri e propri già presenti nel **DataArray**
941
+ *
942
+ * I callback **onLoadStart** e **onLoadEnd** vengono sempre chiamati
943
+ *
944
+ * @param {{ data: LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any, index: number }} nd Indice del caricamento dati, con eventualmente già i dati se disponibili
945
+ */
946
+ changePage(nd) {
947
+ if (!nd.data) {
948
+ this.loadingChart = true;
949
+ // Serve per informare l'applicativo in listening sull'indice attualmente in visualizzazione.
950
+ // La mancanza di dati indica che non devono essere effettuate ricerche per ora
951
+ if (this.DataRetrieve)
952
+ this.DataRetrieve(null, nd.index);
953
+ this.onLoadStart.emit();
954
+ return;
955
+ }
956
+ if (this.DataRetrieve)
957
+ this.DataRetrieve(nd.data, nd.index).then(t => { this.changePageDataReceived(t); });
958
+ else
959
+ this.changePageDataReceived(nd.data);
960
+ }
961
+ /**
962
+ * Al termine del caricamento dei dati di una pagina questo metodo viene chiamato per rigraficare la situazione con i nuovi dati
963
+ *
964
+ * @param {LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any} data Dati del grafico
965
+ */
966
+ changePageDataReceived(data) {
967
+ this.loadingChart = false;
968
+ this.onLoadEnd.emit();
969
+ let firstBind = !this.Data;
970
+ this.Data = data;
971
+ if (!firstBind)
972
+ this.reloadChart();
973
+ else
974
+ this.dispatchLoadChart();
975
+ }
976
+ /**
977
+ * Ricarica il grafico distruggendo il vecchio e ricreando il nuovo
978
+ *
979
+ * Le chiamate a questo metodo possono essere trasformate in chiamate al metodo **graphicate** della Service, se solo quel metodo fosse abbastanza intelligente per capire
980
+ * le differenze fra il grafico com'era prima e come deve diventare, in modo da non ricrearlo ma semplicemente modificare quello che già è disegnato
981
+ */
982
+ reloadChart() {
983
+ this.browserOnly(() => { if (!this.Chart.isDisposed())
984
+ this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
985
+ this.Dispatcher.register(this.name, () => { return this.loadChart(); });
986
+ }
987
+ /**
988
+ * Permette di aggiungere un blocco di dati in maniera "live" ad un grafico
989
+ */
990
+ addData(chartData) {
991
+ this.ChartService.refreshData(chartData);
992
+ }
993
+ ;
994
+ /**
995
+ * Funzione che si occupa di caricare i temi necessari per il grafico in oggetto. Prima applica il tema, poi, se serve, applica le animazioni
996
+ */
997
+ setupAmChartsThemes() {
998
+ return Promise.all([
999
+ this.Charter.applyTheme(am4core, this.Theme).then(() => {
1000
+ return this.Animations ? this.Charter.applyAnimations(am4core) : this.Charter.unapplyAnimations(am4core);
1001
+ })
1002
+ ]);
1003
+ }
1004
+ /**
1005
+ * @ignore
1006
+ */
1007
+ log(log) {
1008
+ if (this.logs)
1009
+ console.log("@esfaenza/es-charts: " + log);
1010
+ }
1011
+ /**
1012
+ * @ignore
1013
+ */
1014
+ browserOnly(f) {
1015
+ if (isPlatformBrowser(this.platformId)) {
1016
+ this.zone.runOutsideAngular(() => {
1017
+ f();
1018
+ });
1019
+ }
1020
+ }
1021
+ }
1022
+ BaseChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseChartComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1023
+ 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", chartLoaded: "chartLoaded" }, queries: [{ propertyName: "header_tr", first: true, predicate: ["header"], descendants: true }, { propertyName: "loading_template", first: true, predicate: ["loading"], descendants: true }], usesOnChanges: true, ngImport: i0 });
1024
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseChartComponent, decorators: [{
1025
+ type: Directive
1026
+ }], 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: [{
1027
+ type: Input
1028
+ }], YTitle: [{
1029
+ type: Input
1030
+ }], Settings: [{
1031
+ type: Input
1032
+ }], Legend: [{
1033
+ type: Input
1034
+ }], LegendPosition: [{
1035
+ type: Input
1036
+ }], Timeline: [{
1037
+ type: Input
1038
+ }], name: [{
1039
+ type: Input
1040
+ }], Animations: [{
1041
+ type: Input
1042
+ }], Theme: [{
1043
+ type: Input
1044
+ }], Locale: [{
1045
+ type: Input
1046
+ }], HideSeriesOnLabelClick: [{
1047
+ type: Input
1048
+ }], MinGridDistance: [{
1049
+ type: Input
1050
+ }], AdaptLabelSizeAndOrientation: [{
1051
+ type: Input
1052
+ }], LegendPadding: [{
1053
+ type: Input
1054
+ }], DataDtos: [{
1055
+ type: Input
1056
+ }], DataDtoStartIndex: [{
1057
+ type: Input
1058
+ }], DataRetrieve: [{
1059
+ type: Input
1060
+ }], BrowseDelayMs: [{
1061
+ type: Input
1062
+ }], header_tr: [{
1063
+ type: ContentChild,
1064
+ args: ['header', { static: false }]
1065
+ }], loading_template: [{
1066
+ type: ContentChild,
1067
+ args: ['loading', { static: false }]
1068
+ }], onSelectionChanged: [{
1069
+ type: Output
1070
+ }], onSeriesClicked: [{
1071
+ type: Output
1072
+ }], onLoadStart: [{
1073
+ type: Output
1074
+ }], onLoadEnd: [{
1075
+ type: Output
1076
+ }], chartLoaded: [{
1077
+ type: Output
1078
+ }] } });
1079
+
1080
+ /**
1081
+ * Classe il cui unico scopo è gestire il setup e rendering di un LineChart
1082
+ */
1083
+ class LineChartService {
1084
+ /** @ignore */
1085
+ constructor(Adapter, dateExts) {
1086
+ this.Adapter = Adapter;
1087
+ this.dateExts = dateExts;
1088
+ /** @ignore */
1089
+ this.DataGroupBucketSize = 1500;
1090
+ /** @ignore */
1091
+ this.OpacityOnSelected = 0.3;
1092
+ /** @ignore */
1093
+ this.singleDataSet = false;
1094
+ //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
1095
+ //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
1096
+ /** @ignore */
1097
+ this.executionTimers = {};
1098
+ }
1099
+ /**
1100
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un LineChart
1101
+ */
1102
+ graphicate(data, settings) {
1103
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1104
+ let threshold = settings.DataGroupingThreshold ?? 3000;
1105
+ this.singleDataSet = settings.MergeDatasets ?? false;
1106
+ let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
1107
+ let dataShouldBeGrouped = Math.max(...dataConverted.series.map(t => t.values.length)) > threshold;
1108
+ let showTimeline = settings.Timeline || dataShouldBeGrouped;
1109
+ let seriesWithInterval = dataConverted.series.some(t => t.interval);
1110
+ let interval = seriesWithInterval ? dataConverted.series.find(t => t.interval).interval : null;
1111
+ let gapsAllowed = settings?.AllowGaps == null ? seriesWithInterval : settings?.AllowGaps;
1112
+ let finalInstant = settings?.FinalInstants ?? true;
1113
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1114
+ am4core.options.autoDispose = true;
1115
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1116
+ let ChartInstanceCasted = this.ChartInstance;
1117
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1118
+ if (settings.YAxisTitle) {
1119
+ yAxis.title.text = settings.YAxisTitle;
1120
+ yAxis.title.fontWeight = "bold";
1121
+ }
1122
+ if (settings.Min)
1123
+ yAxis.min = settings.Min;
1124
+ if (settings.Max)
1125
+ yAxis.max = settings.Max;
1126
+ if (dataConverted.limit) {
1127
+ if (dataConverted.limit.upper != null && dataConverted.limit.upper != undefined) {
1128
+ let range = yAxis.axisRanges.create();
1129
+ range.value = dataConverted.limit.upper;
1130
+ range.label.inside = true;
1131
+ range.label.text = dataConverted.limit.upperLabel;
1132
+ range.label.fill = range.grid.stroke;
1133
+ range.label.verticalCenter = "bottom";
1134
+ range.label.stroke = am4core.color(dataConverted.limit.upperColor || "#F92200");
1135
+ range.grid.stroke = am4core.color(dataConverted.limit.upperColor || "#F92200");
1136
+ range.grid.strokeWidth = 2;
1137
+ range.grid.strokeOpacity = 1;
1138
+ }
1139
+ if (dataConverted.limit.lower != null && dataConverted.limit.lower != undefined) {
1140
+ let range = yAxis.axisRanges.create();
1141
+ range.value = dataConverted.limit.lower;
1142
+ range.label.inside = true;
1143
+ range.label.text = dataConverted.limit.lowerLabel;
1144
+ range.label.fill = range.grid.stroke;
1145
+ range.label.verticalCenter = "bottom";
1146
+ range.label.stroke = am4core.color(dataConverted.limit.lowerColor || "#F92200");
1147
+ range.grid.stroke = am4core.color(dataConverted.limit.lowerColor || "#F92200");
1148
+ range.grid.strokeWidth = 2;
1149
+ range.grid.strokeOpacity = 1;
1150
+ }
1151
+ }
1152
+ let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
1153
+ if (settings.XAxisTitle) {
1154
+ dateAxis.title.text = settings.XAxisTitle;
1155
+ dateAxis.title.fontWeight = "bold";
1156
+ }
1157
+ if (showTicks) {
1158
+ dateAxis.renderer.ticks.template.disabled = false;
1159
+ dateAxis.renderer.ticks.template.strokeOpacity = 1;
1160
+ dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
1161
+ dateAxis.renderer.ticks.template.strokeWidth = 2;
1162
+ dateAxis.renderer.ticks.template.length = 10;
1163
+ dateAxis.renderer.ticks.template.location = 0;
1164
+ }
1165
+ dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
1166
+ dateAxis.renderer.grid.template.location = 0;
1167
+ dateAxis.minZoomCount = 5;
1168
+ dateAxis.groupData = dataShouldBeGrouped;
1169
+ dateAxis.groupCount = settings.DataGroupBucketSize ?? this.DataGroupBucketSize;
1170
+ //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
1171
+ if (gapsAllowed) {
1172
+ if (!seriesWithInterval) {
1173
+ console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
1174
+ return null;
1175
+ }
1176
+ dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
1177
+ }
1178
+ if (showTimeline)
1179
+ ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
1180
+ let seriesToPush = [];
1181
+ let seriesColors = [];
1182
+ let defaultIndex = 0;
1183
+ //-- Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
1184
+ if (this.singleDataSet) {
1185
+ this.ChartInstance.data = this.generateSingleDataset(dataConverted);
1186
+ ;
1187
+ dateAxis.cursorTooltipEnabled = false;
1188
+ }
1189
+ //-- Fine generazione
1190
+ dataConverted.series.forEach((s, index) => {
1191
+ if (s.values[0] && !(s.values[0].d instanceof Date)) {
1192
+ for (let v = 0; v < s.values.length; v++)
1193
+ s.values[v].d = new Date(s.values[v].d);
1194
+ }
1195
+ var correctOrder = true;
1196
+ var prevDate = null;
1197
+ for (let v = 0; v < s.values.length; v++) {
1198
+ if (!prevDate)
1199
+ prevDate = s.values[v].d;
1200
+ else if (s.values[v].d < prevDate) {
1201
+ correctOrder = false;
1202
+ break;
1203
+ }
1204
+ }
1205
+ if (!correctOrder)
1206
+ s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
1207
+ let fill = s.fill != null && s.fill != undefined ? s.fill : (settings?.Fill ?? false);
1208
+ let series = settings?.Step ? new am4charts.StepLineSeries() : new am4charts.LineSeries();
1209
+ series.dataFields.valueY = "v" + (this.singleDataSet ? index : "");
1210
+ series.dataFields.dateX = "d";
1211
+ series.dataFields.measureUnit = s.uom;
1212
+ series.name = s.name;
1213
+ series.strokeWidth = settings?.StrokeSize ?? 1;
1214
+ series.connect = !gapsAllowed;
1215
+ series.minBulletDistance = 10;
1216
+ series.tooltipText = this.singleDataSet ? "" : "{name}: [bold]{valueY}[/]";
1217
+ series.tooltip.pointerOrientation = "vertical";
1218
+ series.tooltip.background.fillOpacity = 0.5;
1219
+ series.tooltip.label.padding(12, 12, 12, 12);
1220
+ series.fillOpacity = fill ? 1 : 0.0001;
1221
+ series.stacked = fill;
1222
+ //Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
1223
+ //altrimenti assegno i dati della serie direttamente alla serie
1224
+ if (this.singleDataSet) {
1225
+ series.tooltip.getFillFromObject = false;
1226
+ series.tooltip.background.fill = am4core.color("#eee");
1227
+ series.tooltip.label.fill = am4core.color("#00");
1228
+ series.tooltip.defaultState.transitionDuration = 0;
1229
+ series.tooltip.hiddenState.transitionDuration = 0;
1230
+ //Utilizzo il mio dateService per la formattazione della data in modo che non debba mai gestire n formati fra n librerie... bellissimo
1231
+ series.dateFormatter.format = (source) => {
1232
+ if (interval && finalInstant) {
1233
+ let timepart = null;
1234
+ switch (interval.timeunit) {
1235
+ case "hour":
1236
+ timepart = 'day';
1237
+ break;
1238
+ case "minute":
1239
+ timepart = 'hour';
1240
+ break;
1241
+ case "second":
1242
+ timepart = 'minute';
1243
+ break;
1244
+ }
1245
+ if (timepart)
1246
+ return this.dateExts.adjustDateToFinalInstant(source, timepart, interval ? interval.timeunit == "second" : false);
1247
+ }
1248
+ else
1249
+ return this.dateExts.getFormatted(source, false, interval ? interval.timeunit == "second" : false);
1250
+ };
1251
+ series.adapter.add("tooltipText", () => {
1252
+ var text = "[bold]{dateX.formatDate()}[/]\n";
1253
+ this.ChartInstance.series.each((item) => {
1254
+ let uom = " [font-style: italic]" + series.dataFields.measureUnit || "" + "[/]";
1255
+ text += "[" + item.stroke.hex + "]●[/] " + item.name + ": [bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
1256
+ });
1257
+ return text;
1258
+ });
1259
+ }
1260
+ else
1261
+ series.data = s.values;
1262
+ let segment = series.segments.template;
1263
+ let hoverState = segment.states.create("hover");
1264
+ hoverState.properties.strokeWidth = (settings?.StrokeSize ?? 1) + 1;
1265
+ let dimmed = segment.states.create("dimmed");
1266
+ dimmed.properties.stroke = am4core.color("#dadada");
1267
+ //Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
1268
+ if (s.color)
1269
+ seriesColors.push(am4core.color(s.color));
1270
+ else {
1271
+ seriesColors.push(ChartInstanceCasted.colors.list[defaultIndex % ChartInstanceCasted.colors.list.length]);
1272
+ defaultIndex++;
1273
+ }
1274
+ seriesToPush.push(series);
1275
+ });
1276
+ ChartInstanceCasted.colors.list = seriesColors;
1277
+ //Scrivo le serie nel grafico
1278
+ seriesToPush.forEach(s => {
1279
+ ChartInstanceCasted.series.push(s);
1280
+ if (showTimeline)
1281
+ ChartInstanceCasted.scrollbarX.series.push(s);
1282
+ });
1283
+ if (settings.Legend) {
1284
+ this.ChartInstance.legend = new am4charts.Legend();
1285
+ this.ChartInstance.legend.position = settings?.LegendPosition ?? 'right';
1286
+ this.ChartInstance.legend.scrollable = true;
1287
+ this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
1288
+ this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
1289
+ this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
1290
+ if (settings.LegendPadding) {
1291
+ let template = this.ChartInstance.legend.itemContainers.template;
1292
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1293
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1294
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1295
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1296
+ }
1297
+ }
1298
+ this.ChartInstance.cursor = new am4charts.XYCursor();
1299
+ //Prove******************************************************************************************************************************
1300
+ // this.ChartInstance.cursor.events.on("cursorpositionchanged", (ev) => {
1301
+ // //var value = dateAxis.positionToDate(dateAxis.toAxisPosition(ev.target.xPosition));
1302
+ // var dt = dateAxis.series.values.find(t => t.dataItem.values.dateX);
1303
+ // if (dt && dt.dataItem) {
1304
+ // console.log(dt.dataItem.values);
1305
+ // // this.ChartInstance.tooltipText = dt;
1306
+ // }
1307
+ // else {
1308
+ // this.ChartInstance.tooltipText = "";
1309
+ // }
1310
+ // });
1311
+ //******************************************************************************************************************************
1312
+ this.ChartInstance.cursor.xAxis = dateAxis;
1313
+ this.ChartInstance.cursor.yAxis = yAxis;
1314
+ if (this.singleDataSet)
1315
+ this.ChartInstance.cursor.maxTooltipDistance = -1;
1316
+ //TODO: Cercare di capire perché è figlio di puttana......
1317
+ dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
1318
+ dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1319
+ return this;
1320
+ }
1321
+ /** @ignore */
1322
+ refreshData(data) {
1323
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1324
+ if (this.singleDataSet) {
1325
+ var data = this.generateSingleDataset(dataConverted);
1326
+ this.ChartInstance.addData(data);
1327
+ return;
1328
+ }
1329
+ this.ChartInstance.series.each(s => {
1330
+ var relativeSerie = dataConverted.series.find(t => t.name == s.name);
1331
+ // Una serie del grafico è stata ggiornata, ordino i datapoint e li aggiungo
1332
+ var correctOrder = true;
1333
+ var prevDate = null;
1334
+ for (let v = 0; v < relativeSerie.values.length; v++) {
1335
+ if (!prevDate)
1336
+ prevDate = relativeSerie.values[v].d;
1337
+ else if (relativeSerie.values[v].d < prevDate) {
1338
+ correctOrder = false;
1339
+ break;
1340
+ }
1341
+ }
1342
+ if (!correctOrder)
1343
+ relativeSerie.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
1344
+ for (let v = 0; v < relativeSerie.values.length; v++) {
1345
+ let obj = relativeSerie.values[v];
1346
+ s.addData({ date: obj.d, value: obj.v });
1347
+ }
1348
+ });
1349
+ }
1350
+ /** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
1351
+ generateSingleDataset(data) {
1352
+ let dto = {};
1353
+ data.series.forEach((vs, index) => {
1354
+ for (let i = 0; i < vs.values.length; i++) {
1355
+ var dataitem = vs.values[i];
1356
+ var indexer = new Date(dataitem.d).valueOf();
1357
+ if (!dto[indexer])
1358
+ dto[indexer] = {};
1359
+ dto[indexer]['v' + index] = dataitem.v;
1360
+ }
1361
+ });
1362
+ var dates = Object.keys(dto);
1363
+ var ret = [];
1364
+ for (let i = 0; i < dates.length; i++) {
1365
+ let values = dto[dates[i]];
1366
+ let item = { d: new Date(parseInt(dates[i])) };
1367
+ var vals = Object.keys(values);
1368
+ for (let ii = 0; ii < vals.length; ii++) {
1369
+ let series = vals[ii];
1370
+ let singleVal = values[series];
1371
+ item[series] = singleVal;
1372
+ }
1373
+ ret.push(item);
1374
+ }
1375
+ return ret;
1376
+ }
1377
+ /** @ignore */
1378
+ emitSelectionChanged(ev, settings) {
1379
+ if (settings.OnSelectionChangedCallback) {
1380
+ this.throttla("selchange", () => {
1381
+ var axis = ev.target;
1382
+ var start = new Date(axis.minZoomed);
1383
+ var end = new Date(axis.maxZoomed);
1384
+ var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
1385
+ settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
1386
+ }, 150);
1387
+ }
1388
+ }
1389
+ /** @ignore */
1390
+ processOver(hoveredSeries) {
1391
+ hoveredSeries.toFront();
1392
+ let fill = hoveredSeries.stacked;
1393
+ hoveredSeries.segments.each((segment) => {
1394
+ segment.setState("hover");
1395
+ if (!fill)
1396
+ segment.fillSprite.fillOpacity = this.OpacityOnSelected;
1397
+ });
1398
+ if (!fill)
1399
+ hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
1400
+ this.ChartInstance.series.each((series) => {
1401
+ if (series != hoveredSeries) {
1402
+ let fill = series.stacked;
1403
+ series.segments.each((segment) => {
1404
+ segment.setState("dimmed");
1405
+ if (!fill)
1406
+ segment.fillSprite.fillOpacity = 0;
1407
+ });
1408
+ }
1409
+ });
1410
+ }
1411
+ /** @ignore */
1412
+ processOut() {
1413
+ this.ChartInstance.series.each((series) => {
1414
+ let fill = series.stacked;
1415
+ series.segments.each((segment) => {
1416
+ segment.setState("default");
1417
+ if (!fill)
1418
+ segment.fillSprite.fillOpacity = 0;
1419
+ });
1420
+ if (!fill)
1421
+ series.legendDataItem.marker.children.getIndex(1).fillOpacity = 0;
1422
+ });
1423
+ }
1424
+ /** @ignore */
1425
+ throttla(id, func, throttleTime) {
1426
+ //Se ho la funzione che vuole eseguire ripulisco quel timeout
1427
+ if (this.executionTimers[id])
1428
+ clearTimeout(this.executionTimers[id]);
1429
+ //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
1430
+ this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
1431
+ }
1432
+ }
1433
+
1434
+ /**
1435
+ * Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
1436
+ */
1437
+ class AreaChartService {
1438
+ /** @ignore */
1439
+ constructor(Adapter) {
1440
+ this.Adapter = Adapter;
1441
+ //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
1442
+ //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
1443
+ /** @ignore */
1444
+ this.executionTimers = {};
1445
+ }
1446
+ /**
1447
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
1448
+ */
1449
+ graphicate(data, settings) {
1450
+ if (settings.Timeline) {
1451
+ console.error("Timeline not supported for area chart");
1452
+ return null;
1453
+ }
1454
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
1455
+ let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
1456
+ let interval = dataConverted.interval;
1457
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1458
+ am4core.options.autoDispose = true;
1459
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1460
+ let ChartInstanceCasted = this.ChartInstance;
1461
+ if (settings.Legend) {
1462
+ ChartInstanceCasted.legend = new am4charts.Legend();
1463
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1464
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1465
+ if (settings.LegendPadding) {
1466
+ let template = this.ChartInstance.legend.itemContainers.template;
1467
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1468
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1469
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1470
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1471
+ }
1472
+ }
1473
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1474
+ yAxis.tooltip.disabled = true;
1475
+ if (settings.YAxisTitle) {
1476
+ yAxis.title.text = settings.YAxisTitle;
1477
+ yAxis.title.fontWeight = "bold";
1478
+ }
1479
+ yAxis.min = 0;
1480
+ let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
1481
+ dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
1482
+ dateAxis.startLocation = 0.5;
1483
+ dateAxis.endLocation = 0.5;
1484
+ if (settings.XAxisTitle) {
1485
+ dateAxis.title.text = settings.XAxisTitle;
1486
+ dateAxis.title.fontWeight = "bold";
1487
+ }
1488
+ if (showTicks) {
1489
+ dateAxis.renderer.ticks.template.disabled = false;
1490
+ dateAxis.renderer.ticks.template.strokeOpacity = 1;
1491
+ dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
1492
+ dateAxis.renderer.ticks.template.strokeWidth = 2;
1493
+ dateAxis.renderer.ticks.template.length = 10;
1494
+ dateAxis.renderer.ticks.template.location = 0;
1495
+ }
1496
+ if (!!interval)
1497
+ dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
1498
+ // Unisco il dataset e tiro fuori i dati
1499
+ let chartData = [];
1500
+ let seriesToMakeCache = {};
1501
+ let seriesToMake = [];
1502
+ for (let i = 0; i < dataConverted.groups.length; i++) {
1503
+ let group = dataConverted.groups[i];
1504
+ let dataItem = { date: group.name };
1505
+ for (let ii = 0; ii < group.values.length; ii++) {
1506
+ let val = group.values[ii];
1507
+ dataItem[val.k] = val.v;
1508
+ if (!seriesToMakeCache[val.k]) {
1509
+ seriesToMakeCache[val.k] = true;
1510
+ seriesToMake.push(val.k);
1511
+ }
1512
+ }
1513
+ chartData.push(dataItem);
1514
+ }
1515
+ ChartInstanceCasted.data = chartData;
1516
+ //---------------------------------------------------------
1517
+ seriesToMake.forEach(s => { this.createSeries(ChartInstanceCasted, s); });
1518
+ ChartInstanceCasted.cursor = new am4charts.XYCursor();
1519
+ ChartInstanceCasted.cursor.xAxis = dateAxis;
1520
+ dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
1521
+ dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1522
+ return this;
1523
+ }
1524
+ /** @ignore */
1525
+ refreshData(data) {
1526
+ //TODO:IMPL
1527
+ }
1528
+ /** @ignore */
1529
+ emitSelectionChanged(ev, settings) {
1530
+ if (settings.OnSelectionChangedCallback) {
1531
+ this.throttla("selchange", () => {
1532
+ var axis = ev.target;
1533
+ var start = new Date(axis.minZoomed);
1534
+ var end = new Date(axis.maxZoomed);
1535
+ var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
1536
+ settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
1537
+ }, 150);
1538
+ }
1539
+ }
1540
+ /** @ignore */
1541
+ createSeries(chart, name) {
1542
+ let series = chart.series.push(new am4charts.LineSeries());
1543
+ series.dataFields.dateX = "date";
1544
+ series.name = name[0].toUpperCase() + name.slice(1);
1545
+ series.dataFields.valueY = name;
1546
+ series.tooltipText = "[#000]{valueY.value}[/]";
1547
+ //series.tooltip.background.fill = am4core.color("#FFF");
1548
+ series.tooltip.getStrokeFromObject = true;
1549
+ series.tooltip.background.strokeWidth = 3;
1550
+ series.tooltip.getFillFromObject = false;
1551
+ series.fillOpacity = 0.6;
1552
+ series.strokeWidth = 2;
1553
+ series.stacked = true;
1554
+ return series;
1555
+ }
1556
+ /** @ignore */
1557
+ throttla(id, func, throttleTime) {
1558
+ //Se ho la funzione che vuole eseguire ripulisco quel timeout
1559
+ if (this.executionTimers[id])
1560
+ clearTimeout(this.executionTimers[id]);
1561
+ //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
1562
+ this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
1563
+ }
1564
+ }
1565
+
1566
+ /**
1567
+ * Classe il cui unico scopo è gestire il setup e rendering di un PieChart
1568
+ */
1569
+ class PieChartService {
1570
+ /** @ignore */
1571
+ constructor(Adapter) {
1572
+ this.Adapter = Adapter;
1573
+ /** @ignore */
1574
+ this.ViewAbsoluteValues = true;
1575
+ }
1576
+ /**
1577
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un PieChart
1578
+ */
1579
+ graphicate(data, settings) {
1580
+ if (settings.Timeline) {
1581
+ console.error("Timeline not supported for pie chart");
1582
+ return null;
1583
+ }
1584
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1585
+ am4core.options.autoDispose = true;
1586
+ this.ChartInstance = am4core.create(settings.Name, settings.Mode3D ? am4charts.PieChart3D : am4charts.PieChart);
1587
+ this.ChartInstance.innerRadius = ((settings.DonutRadiusPercentage || 15) / 100) * settings.ContainerHeight;
1588
+ let series = this.ChartInstance.series.push(settings.Mode3D ? new am4charts.PieSeries3D() : new am4charts.PieSeries());
1589
+ series.dataFields.value = "v";
1590
+ series.dataFields.category = "k";
1591
+ //Il default sono valori percentuali
1592
+ if (this.ViewAbsoluteValues) {
1593
+ series.legendSettings.valueText = "{value}";
1594
+ series.labels.template.text = "{category}: [bold]{value}[/]";
1595
+ }
1596
+ series.slices.template.stroke = am4core.color("#fff");
1597
+ series.slices.template.strokeOpacity = 1;
1598
+ series.slices.template.togglable = false;
1599
+ series.hiddenState.properties.opacity = 1;
1600
+ series.hiddenState.properties.endAngle = -90;
1601
+ series.hiddenState.properties.startAngle = -90;
1602
+ if (settings.HideZeroes == null ? true : settings.HideZeroes) {
1603
+ series.ticks.template.events.on("ready", this.hideZeroes);
1604
+ series.ticks.template.events.on("visibilitychanged", this.hideZeroes);
1605
+ series.labels.template.events.on("ready", this.hideZeroes);
1606
+ series.labels.template.events.on("visibilitychanged", this.hideZeroes);
1607
+ }
1608
+ series.slices.template.events.on("hit", (ev) => {
1609
+ if (settings.OnSeriesClickCallback) {
1610
+ let clickedSeries = ev.target.dataItem.dataContext.k;
1611
+ settings.OnSeriesClickCallback(clickedSeries);
1612
+ }
1613
+ });
1614
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForPieChart(data) : data;
1615
+ let defaultIndex = 0;
1616
+ for (let i = 0; i < dataConverted.values.length; i++) {
1617
+ if (!dataConverted.values[i].c) {
1618
+ dataConverted.values[i].c = this.ChartInstance.colors.list[defaultIndex % this.ChartInstance.colors.list.length];
1619
+ defaultIndex++;
1620
+ }
1621
+ else
1622
+ dataConverted.values[i].c = am4core.color(dataConverted.values[i].c);
1623
+ }
1624
+ series.slices.template.propertyFields.fill = "c";
1625
+ this.ChartInstance.data = dataConverted.values;
1626
+ if (!settings.LabelsVisible) {
1627
+ series.labels.template.disabled = true;
1628
+ series.ticks.template.disabled = true;
1629
+ }
1630
+ else if (settings.LabelsWrap || settings.LabelsTruncate) {
1631
+ series.labels.template.maxWidth = settings.LabelsWidth || 100;
1632
+ if (settings.LabelsWrap)
1633
+ series.labels.template.wrap = true;
1634
+ else if (settings.LabelsTruncate)
1635
+ series.labels.template.truncate = true;
1636
+ }
1637
+ if (settings.Legend) {
1638
+ let legend = new am4charts.Legend();
1639
+ this.ChartInstance.legend = legend;
1640
+ legend.position = settings?.LegendPosition || "bottom";
1641
+ legend.itemContainers.template.togglable = settings.HideSeriesOnLabelClick === true;
1642
+ legend.itemContainers.template.tooltipText = "{category}";
1643
+ //Se la legenda non fa il toggle della serie la considero come se fosse un click sulla serie in se
1644
+ if (!settings.HideSeriesOnLabelClick) {
1645
+ legend.itemContainers.template.events.on("hit", (ev) => {
1646
+ if (settings.OnSeriesClickCallback) {
1647
+ let clickedSeries = ev.target.dataItem.dataContext.legendDataItem.name;
1648
+ settings.OnSeriesClickCallback(clickedSeries);
1649
+ }
1650
+ });
1651
+ }
1652
+ if (settings.LegendPadding) {
1653
+ let template = this.ChartInstance.legend.itemContainers.template;
1654
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1655
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1656
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1657
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1658
+ }
1659
+ }
1660
+ return this;
1661
+ }
1662
+ /** @ignore */
1663
+ refreshData(data) {
1664
+ //TODO:IMPL
1665
+ }
1666
+ /** @ignore */
1667
+ hideZeroes(ev) {
1668
+ if (ev.target.dataItem && (ev.target.dataItem.values.value.percent == 0))
1669
+ ev.target.hide();
1670
+ else
1671
+ ev.target.show();
1672
+ }
1673
+ }
1674
+
1675
+ /**
1676
+ * Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
1677
+ */
1678
+ class Vertical2DChartService {
1679
+ /** @ignore */
1680
+ constructor(Adapter) {
1681
+ this.Adapter = Adapter;
1682
+ /** @ignore */
1683
+ this.DefaultGroupPaddingPercentage = 5;
1684
+ /** @ignore */
1685
+ this.dangerZone = 50;
1686
+ /** @ignore */
1687
+ this.LabelWidth = 150;
1688
+ /** @ignore */
1689
+ this.LabelRightWhenCompressed = 20;
1690
+ /** @ignore */
1691
+ this.LabelTopWhenCompressed = -5;
1692
+ /** @ignore */
1693
+ this.DefaultColumnWidthPercentage = 85;
1694
+ }
1695
+ /**
1696
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un Vertical2DChart
1697
+ */
1698
+ graphicate(data, settings) {
1699
+ if (settings.Timeline) {
1700
+ console.error("Timeline not supported for vertical chart");
1701
+ return null;
1702
+ }
1703
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1704
+ am4core.options.autoDispose = true;
1705
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1706
+ let ChartInstanceCasted = this.ChartInstance;
1707
+ if (settings.Legend) {
1708
+ ChartInstanceCasted.legend = new am4charts.Legend();
1709
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1710
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1711
+ if (settings.LegendPadding) {
1712
+ let template = this.ChartInstance.legend.itemContainers.template;
1713
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1714
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1715
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1716
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1717
+ }
1718
+ }
1719
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1720
+ if (settings.YAxisTitle) {
1721
+ yAxis.title.text = settings.YAxisTitle;
1722
+ yAxis.title.fontWeight = "bold";
1723
+ }
1724
+ let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
1725
+ if (settings.XAxisTitle) {
1726
+ categoryAxis.title.text = settings.XAxisTitle;
1727
+ categoryAxis.title.fontWeight = "bold";
1728
+ }
1729
+ yAxis.min = 0;
1730
+ categoryAxis.dataFields.category = 'key';
1731
+ categoryAxis.renderer.cellStartLocation = am4core.percent(settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage).value;
1732
+ categoryAxis.renderer.cellEndLocation = am4core.percent(100 - (settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage)).value;
1733
+ categoryAxis.renderer.grid.template.location = 0;
1734
+ categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1735
+ let label = categoryAxis.renderer.labels.template;
1736
+ label.truncate = true;
1737
+ label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1738
+ label.tooltipText = "{category}";
1739
+ if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1740
+ categoryAxis.events.on("sizechanged", (ev) => {
1741
+ let axis = ev.target;
1742
+ var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1743
+ if (cellWidth < axis.renderer.labels.template.maxWidth) {
1744
+ let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1745
+ axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1746
+ axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1747
+ axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1748
+ axis.renderer.labels.template.horizontalCenter = "right";
1749
+ axis.renderer.labels.template.verticalCenter = "middle";
1750
+ }
1751
+ else {
1752
+ axis.renderer.labels.template.rotation = 0;
1753
+ axis.renderer.labels.template.dx = 0;
1754
+ axis.renderer.labels.template.dy = 0;
1755
+ axis.renderer.labels.template.horizontalCenter = "middle";
1756
+ axis.renderer.labels.template.verticalCenter = "top";
1757
+ }
1758
+ });
1759
+ }
1760
+ let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVertical2DChart(data) : data;
1761
+ let dataConverted = [];
1762
+ for (let i = 0; i < dataPreConverted.groups.length; i++) {
1763
+ let item = dataPreConverted.groups[i];
1764
+ let obj = { key: item.name };
1765
+ for (let p = 0; p < item.values.length; p++) {
1766
+ let value = item.values[p];
1767
+ obj[value.k] = value.v;
1768
+ }
1769
+ dataConverted.push(obj);
1770
+ }
1771
+ ChartInstanceCasted.data = dataConverted;
1772
+ if (dataPreConverted.colorInfos)
1773
+ ChartInstanceCasted.colors.list = dataPreConverted.colorInfos.map(c => am4core.color(c.color));
1774
+ //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
1775
+ for (let prop in dataConverted[0])
1776
+ if (prop !== "key")
1777
+ this.createSeries(ChartInstanceCasted, settings, prop, prop);
1778
+ return this;
1779
+ }
1780
+ /** @ignore */
1781
+ refreshData(data) {
1782
+ //TODO:IMPL
1783
+ }
1784
+ /** @ignore */
1785
+ createSeries(chart, settings, value, name) {
1786
+ let series = chart.series.push(new am4charts.ColumnSeries());
1787
+ series.dataFields.valueY = value;
1788
+ series.dataFields.categoryX = 'key';
1789
+ series.name = name;
1790
+ series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
1791
+ series.columns.template.fillOpacity = .8;
1792
+ series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
1793
+ series.events.on("hidden", () => this.arrangeColumns);
1794
+ series.events.on("shown", () => this.arrangeColumns);
1795
+ return series;
1796
+ }
1797
+ /** @ignore */
1798
+ arrangeColumns() {
1799
+ let ChartInstanceCasted = this.ChartInstance;
1800
+ let series = ChartInstanceCasted.series.getIndex(0);
1801
+ let xAxis = ChartInstanceCasted.xAxes.getIndex(0);
1802
+ let w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
1803
+ if (series.dataItems.length > 1) {
1804
+ let x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
1805
+ let x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
1806
+ let delta = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
1807
+ if (am4core.isNumber(delta)) {
1808
+ let middle = ChartInstanceCasted.series.length / 2;
1809
+ let newIndex = 0;
1810
+ ChartInstanceCasted.series.each((series) => {
1811
+ if (!series.isHidden && !series.isHiding) {
1812
+ series.dummyData = newIndex;
1813
+ newIndex++;
1814
+ }
1815
+ else {
1816
+ series.dummyData = ChartInstanceCasted.series.indexOf(series);
1817
+ }
1818
+ });
1819
+ let visibleCount = newIndex;
1820
+ let newMiddle = visibleCount / 2;
1821
+ ChartInstanceCasted.series.each((series) => {
1822
+ let trueIndex = ChartInstanceCasted.series.indexOf(series);
1823
+ let newIndex = series.dummyData;
1824
+ let dx = (newIndex - trueIndex + middle - newMiddle) * delta;
1825
+ series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1826
+ series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1827
+ });
1828
+ }
1829
+ }
1830
+ }
1831
+ }
1832
+
1833
+ /**
1834
+ * Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
1835
+ */
1836
+ class VerticalChartService {
1837
+ /** @ignore */
1838
+ constructor(Adapter) {
1839
+ this.Adapter = Adapter;
1840
+ /** @ignore */
1841
+ this.dangerZone = 50;
1842
+ /** @ignore */
1843
+ this.LabelWidth = 150;
1844
+ /** @ignore */
1845
+ this.LabelRightWhenCompressed = 20;
1846
+ /** @ignore */
1847
+ this.LabelTopWhenCompressed = -5;
1848
+ /** @ignore */
1849
+ this.DefaultColumnWidthPercentage = 85;
1850
+ }
1851
+ /**
1852
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
1853
+ */
1854
+ graphicate(data, settings) {
1855
+ if (settings.Timeline) {
1856
+ console.error("Timeline not supported for vertical chart");
1857
+ return null;
1858
+ }
1859
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1860
+ am4core.options.autoDispose = true;
1861
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1862
+ let ChartInstanceCasted = this.ChartInstance;
1863
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
1864
+ ChartInstanceCasted.data = dataConverted.values;
1865
+ if (settings.Legend) {
1866
+ ChartInstanceCasted.legend = new am4charts.Legend();
1867
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1868
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1869
+ if (settings.LegendPadding) {
1870
+ let template = this.ChartInstance.legend.itemContainers.template;
1871
+ template.paddingTop = settings.LegendPadding.top ?? 0;
1872
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1873
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
1874
+ template.paddingRight = settings.LegendPadding.right ?? 0;
1875
+ }
1876
+ }
1877
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1878
+ if (settings.YAxisTitle) {
1879
+ yAxis.title.text = settings.YAxisTitle;
1880
+ yAxis.title.fontWeight = "bold";
1881
+ }
1882
+ let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
1883
+ if (settings.XAxisTitle) {
1884
+ categoryAxis.title.text = settings.XAxisTitle;
1885
+ categoryAxis.title.fontWeight = "bold";
1886
+ }
1887
+ categoryAxis.dataFields.category = "k";
1888
+ categoryAxis.renderer.grid.template.location = 0;
1889
+ categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1890
+ let label = categoryAxis.renderer.labels.template;
1891
+ label.truncate = true;
1892
+ label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1893
+ label.tooltipText = "{category}";
1894
+ if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1895
+ categoryAxis.events.on("sizechanged", (ev) => {
1896
+ let axis = ev.target;
1897
+ var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1898
+ if (cellWidth < axis.renderer.labels.template.maxWidth) {
1899
+ let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1900
+ axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1901
+ axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1902
+ axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1903
+ axis.renderer.labels.template.horizontalCenter = "right";
1904
+ axis.renderer.labels.template.verticalCenter = "middle";
1905
+ }
1906
+ else {
1907
+ axis.renderer.labels.template.rotation = 0;
1908
+ axis.renderer.labels.template.dx = 0;
1909
+ axis.renderer.labels.template.dy = 0;
1910
+ axis.renderer.labels.template.horizontalCenter = "middle";
1911
+ axis.renderer.labels.template.verticalCenter = "top";
1912
+ }
1913
+ });
1914
+ }
1915
+ // Create series
1916
+ let series = ChartInstanceCasted.series.push(new am4charts.ColumnSeries());
1917
+ series.dataFields.valueY = "v";
1918
+ series.dataFields.categoryX = "k";
1919
+ series.name = "";
1920
+ series.columns.template.tooltipText = "{categoryX}: [bold]{valueY}[/]";
1921
+ series.columns.template.fillOpacity = .8;
1922
+ series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
1923
+ let columnTemplate = series.columns.template;
1924
+ columnTemplate.strokeWidth = 2;
1925
+ columnTemplate.strokeOpacity = 1;
1926
+ return this;
1927
+ }
1928
+ /** @ignore */
1929
+ refreshData(data) {
1930
+ //TODO:IMPL
1931
+ }
1932
+ }
1933
+
1934
+ /**
1935
+ * Classe il cui unico scopo è gestire il setup e rendering di un VerticalStackedChart
1936
+ */
1937
+ class VerticalStackedChartService {
1938
+ /** @ignore */
1939
+ constructor(Adapter) {
1940
+ this.Adapter = Adapter;
1941
+ /** @ignore */
1942
+ this.dangerZone = 50;
1943
+ /** @ignore */
1944
+ this.LabelWidth = 150;
1945
+ /** @ignore */
1946
+ this.LabelRightWhenCompressed = 20;
1947
+ /** @ignore */
1948
+ this.LabelTopWhenCompressed = -5;
1949
+ /** @ignore */
1950
+ this.DefaultColumnWidthPercentage = 85;
1951
+ }
1952
+ /**
1953
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalStackedChart
1954
+ */
1955
+ graphicate(data, settings) {
1956
+ if (settings.Timeline) {
1957
+ console.error("Timeline not supported for vertical chart");
1958
+ return null;
1959
+ }
1960
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1961
+ am4core.options.autoDispose = true;
1962
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1963
+ let ChartInstanceCasted = this.ChartInstance;
1964
+ // Create axes
1965
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1966
+ if (settings.YAxisTitle) {
1967
+ yAxis.title.text = settings.YAxisTitle;
1968
+ yAxis.title.fontWeight = "bold";
1969
+ }
1970
+ let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
1971
+ if (settings.XAxisTitle) {
1972
+ categoryAxis.title.text = settings.XAxisTitle;
1973
+ categoryAxis.title.fontWeight = "bold";
1974
+ }
1975
+ yAxis.min = 0;
1976
+ categoryAxis.dataFields.category = "key";
1977
+ categoryAxis.renderer.grid.template.location = 0;
1978
+ categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1979
+ let label = categoryAxis.renderer.labels.template;
1980
+ label.truncate = true;
1981
+ label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1982
+ label.tooltipText = "{category}";
1983
+ if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1984
+ categoryAxis.events.on("sizechanged", (ev) => {
1985
+ let axis = ev.target;
1986
+ var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1987
+ if (cellWidth < axis.renderer.labels.template.maxWidth) {
1988
+ let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1989
+ axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1990
+ axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1991
+ axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1992
+ axis.renderer.labels.template.horizontalCenter = "right";
1993
+ axis.renderer.labels.template.verticalCenter = "middle";
1994
+ }
1995
+ else {
1996
+ axis.renderer.labels.template.rotation = 0;
1997
+ axis.renderer.labels.template.dx = 0;
1998
+ axis.renderer.labels.template.dy = 0;
1999
+ axis.renderer.labels.template.horizontalCenter = "middle";
2000
+ axis.renderer.labels.template.verticalCenter = "top";
2001
+ }
2002
+ });
2003
+ }
2004
+ let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVerticalStackedChart(data) : data;
2005
+ let dataConverted = [];
2006
+ for (let i = 0; i < dataPreConverted.groups.length; i++) {
2007
+ let item = dataPreConverted.groups[i];
2008
+ let obj = { key: item.name };
2009
+ for (let p = 0; p < item.values.length; p++) {
2010
+ let value = item.values[p];
2011
+ obj[value.k] = value.v;
2012
+ }
2013
+ dataConverted.push(obj);
2014
+ }
2015
+ ChartInstanceCasted.data = dataConverted;
2016
+ //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
2017
+ for (let prop in dataConverted[0]) {
2018
+ if (prop !== "key")
2019
+ this.createSeriesStacked(ChartInstanceCasted, settings, prop, prop);
2020
+ }
2021
+ if (settings.Legend) {
2022
+ ChartInstanceCasted.legend = new am4charts.Legend();
2023
+ ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
2024
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
2025
+ if (settings.LegendPadding) {
2026
+ let template = this.ChartInstance.legend.itemContainers.template;
2027
+ template.paddingTop = settings.LegendPadding.top ?? 0;
2028
+ template.paddingBottom = settings.LegendPadding.bottom ?? 0;
2029
+ template.paddingLeft = settings.LegendPadding.left ?? 0;
2030
+ template.paddingRight = settings.LegendPadding.right ?? 0;
2031
+ }
2032
+ }
2033
+ return this;
2034
+ }
2035
+ /** @ignore */
2036
+ refreshData(data) {
2037
+ //TODO:IMPL
2038
+ }
2039
+ /** @ignore */
2040
+ createSeriesStacked(chart, settings, field, name) {
2041
+ // Set up series
2042
+ let series = chart.series.push(new am4charts.ColumnSeries());
2043
+ series.name = name;
2044
+ series.dataFields.valueY = field;
2045
+ series.dataFields.categoryX = "key";
2046
+ series.sequencedInterpolation = true;
2047
+ series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
2048
+ series.columns.template.fillOpacity = .8;
2049
+ series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
2050
+ // Make it stacked
2051
+ series.stacked = true;
2052
+ return series;
2053
+ }
2054
+ }
2055
+
2056
+ /**
2057
+ * Componente specifico per la graficazione di un qualsiasi tipo di grafico.
2058
+ *
2059
+ * Si basa sul tipo specificato dalla proprietà **Type**
2060
+ */
2061
+ class EsChartComponent extends BaseChartComponent {
2062
+ /**
2063
+ * @ignore
2064
+ */
2065
+ constructor(el, ChartLoader, ChartDispatcher, dateService, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2066
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2067
+ this.dateService = dateService;
2068
+ this.adapter = adapter;
2069
+ }
2070
+ /**
2071
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2072
+ */
2073
+ getSpecificPropertiesToCheck() {
2074
+ return ["Data", "Type"];
2075
+ }
2076
+ /**
2077
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2078
+ *
2079
+ * @returns {PieChartSettings | AreaChartSettings | LineChartSettings | VerticalChartSettings | Vertical2DChartSettings | VerticalStackedChartSettings} Settings castati al tipo giusto
2080
+ */
2081
+ getCastedSettings() {
2082
+ switch (this.Type) {
2083
+ case 'pie':
2084
+ return (this.Settings ?? new PieChartSettings());
2085
+ case 'area':
2086
+ return (this.Settings ?? new AreaChartSettings());
2087
+ case 'line':
2088
+ return (this.Settings ?? new LineChartSettings());
2089
+ case 'vertical':
2090
+ return (this.Settings ?? new VerticalChartSettings());
2091
+ case 'vertical-2d':
2092
+ return (this.Settings ?? new Vertical2DChartSettings());
2093
+ case 'vertical-stacked':
2094
+ return (this.Settings ?? new VerticalStackedChartSettings());
2095
+ }
2096
+ }
2097
+ /**
2098
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2099
+ *
2100
+ * @param {PieChartSettings | AreaChartSettings | LineChartSettings | VerticalChartSettings | Vertical2DChartSettings | VerticalStackedChartSettings} settingsCasted Settings castati al tipo giusto
2101
+ */
2102
+ fillSpecificSettings(settingsCasted) {
2103
+ // Nope. Se si usa l'es-chart si danno i settings con l'oggetto
2104
+ }
2105
+ /**
2106
+ * Effettua il rendering di questo grafico in base ai Settings
2107
+ *
2108
+ * @param {PieChartSettings | AreaChartSettings | LineChartSettings | VerticalChartSettings | Vertical2DChartSettings | VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
2109
+ * @returns {PieChartService | AreaChartService | LineChartService | VerticalChartService | Vertical2DChartService | VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2110
+ */
2111
+ graphicate(settings) {
2112
+ switch (this.Type) {
2113
+ case 'pie':
2114
+ return new PieChartService(this.adapter).graphicate(this.Data, settings);
2115
+ case 'area':
2116
+ return new AreaChartService(this.adapter).graphicate(this.Data, settings);
2117
+ case 'line':
2118
+ return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settings);
2119
+ case 'vertical':
2120
+ return new VerticalChartService(this.adapter).graphicate(this.Data, settings);
2121
+ case 'vertical-2d':
2122
+ return new Vertical2DChartService(this.adapter).graphicate(this.Data, settings);
2123
+ case 'vertical-stacked':
2124
+ return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settings);
2125
+ }
2126
+ }
2127
+ }
2128
+ 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 });
2129
+ 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 });
2130
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartComponent, decorators: [{
2131
+ type: Component,
2132
+ 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"] }]
2133
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i2.DateService }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2134
+ type: Inject,
2135
+ args: [PLATFORM_ID]
2136
+ }] }, { type: undefined, decorators: [{
2137
+ type: Inject,
2138
+ args: [ESC_LOGS]
2139
+ }] }, { type: undefined, decorators: [{
2140
+ type: Inject,
2141
+ args: [ESC_ANIMATIONS]
2142
+ }] }, { type: undefined, decorators: [{
2143
+ type: Inject,
2144
+ args: [ESC_LOCALE]
2145
+ }] }, { type: undefined, decorators: [{
2146
+ type: Inject,
2147
+ args: [ESC_THEME]
2148
+ }] }]; }, propDecorators: { Type: [{
2149
+ type: Input
2150
+ }], Data: [{
2151
+ type: Input
2152
+ }], DataArray: [{
2153
+ type: Input
2154
+ }] } });
2155
+
2156
+ /**
2157
+ * Componente specifico per la graficazione di un grafico ad Area
2158
+ */
2159
+ class EsAreaChartComponent extends BaseChartComponent {
2160
+ /**
2161
+ * @ignore
2162
+ */
2163
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2164
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2165
+ this.adapter = adapter;
2166
+ }
2167
+ /**
2168
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2169
+ */
2170
+ getSpecificPropertiesToCheck() {
2171
+ return ["Data", "DataArray"];
2172
+ }
2173
+ /**
2174
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2175
+ *
2176
+ * @returns {AreaChartSettings} Settings castati al tipo giusto
2177
+ */
2178
+ getCastedSettings() {
2179
+ return (this.Settings ?? new AreaChartSettings());
2180
+ }
2181
+ /**
2182
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2183
+ *
2184
+ * @param {AreaChartSettings} settingsCasted Settings castati al tipo giusto
2185
+ */
2186
+ fillSpecificSettings(settingsCasted) {
2187
+ }
2188
+ /**
2189
+ * Effettua il rendering di questo grafico in base ai Settings
2190
+ *
2191
+ * @param {AreaChartSettings} settingsCasted Impostazioni di graficazione
2192
+ * @returns {AreaChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2193
+ */
2194
+ graphicate(settingsCasted) {
2195
+ return new AreaChartService(this.adapter).graphicate(this.Data, settingsCasted);
2196
+ }
2197
+ }
2198
+ 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 });
2199
+ 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 });
2200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsAreaChartComponent, decorators: [{
2201
+ type: Component,
2202
+ 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"] }]
2203
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2204
+ type: Inject,
2205
+ args: [PLATFORM_ID]
2206
+ }] }, { type: undefined, decorators: [{
2207
+ type: Inject,
2208
+ args: [ESC_LOGS]
2209
+ }] }, { type: undefined, decorators: [{
2210
+ type: Inject,
2211
+ args: [ESC_ANIMATIONS]
2212
+ }] }, { type: undefined, decorators: [{
2213
+ type: Inject,
2214
+ args: [ESC_LOCALE]
2215
+ }] }, { type: undefined, decorators: [{
2216
+ type: Inject,
2217
+ args: [ESC_THEME]
2218
+ }] }]; }, propDecorators: { Data: [{
2219
+ type: Input
2220
+ }], DataArray: [{
2221
+ type: Input
2222
+ }] } });
2223
+
2224
+ /**
2225
+ * Componente specifico per la graficazione di un grafico a Linea su un asse temporale
2226
+ */
2227
+ class EsLineChartComponent extends BaseChartComponent {
2228
+ /**
2229
+ * @ignore
2230
+ */
2231
+ constructor(el, ChartLoader, ChartDispatcher, adapter, dateService, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2232
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2233
+ this.adapter = adapter;
2234
+ this.dateService = dateService;
2235
+ }
2236
+ /**
2237
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2238
+ */
2239
+ getSpecificPropertiesToCheck() {
2240
+ return ["Data", "DataArray", "Step", "DataGroupBucketSize", "DataGroupingThreshold", "StrokeSize", "AllowGaps", "MergeDatasets", "FinalInstants", "Fill", "Min", "Max"];
2241
+ }
2242
+ /**
2243
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2244
+ *
2245
+ * @returns {LineChartSettings} Settings castati al tipo giusto
2246
+ */
2247
+ getCastedSettings() {
2248
+ return (this.Settings ?? new LineChartSettings());
2249
+ }
2250
+ /**
2251
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2252
+ *
2253
+ * @param {LineChartSettings} settingsCasted Settings castati al tipo giusto
2254
+ */
2255
+ fillSpecificSettings(settingsCasted) {
2256
+ settingsCasted.Step = settingsCasted.Step != null ? settingsCasted.Step : this.Step;
2257
+ settingsCasted.DataGroupBucketSize = settingsCasted.DataGroupBucketSize != null ? settingsCasted.DataGroupBucketSize : this.DataGroupBucketSize;
2258
+ settingsCasted.StrokeSize = settingsCasted.StrokeSize != null ? settingsCasted.StrokeSize : this.StrokeSize;
2259
+ settingsCasted.DataGroupingThreshold = settingsCasted.DataGroupingThreshold != null ? settingsCasted.DataGroupingThreshold : this.DataGroupingThreshold;
2260
+ settingsCasted.AllowGaps = settingsCasted.AllowGaps != null ? settingsCasted.AllowGaps : this.AllowGaps;
2261
+ settingsCasted.MergeDatasets = settingsCasted.MergeDatasets != null ? settingsCasted.MergeDatasets : this.MergeDatasets;
2262
+ settingsCasted.FinalInstants = settingsCasted.FinalInstants != null ? settingsCasted.FinalInstants : this.FinalInstants;
2263
+ settingsCasted.Min = settingsCasted.Min != null ? settingsCasted.Min : this.Min;
2264
+ settingsCasted.Max = settingsCasted.Max != null ? settingsCasted.Max : this.Max;
2265
+ settingsCasted.Fill = settingsCasted.Fill != null ? settingsCasted.Fill : this.Fill;
2266
+ }
2267
+ /**
2268
+ * Effettua il rendering di questo grafico in base ai Settings
2269
+ *
2270
+ * @param {LineChartSettings} settingsCasted Impostazioni di graficazione
2271
+ * @returns {LineChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2272
+ */
2273
+ graphicate(settingsCasted) {
2274
+ return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settingsCasted);
2275
+ }
2276
+ }
2277
+ 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 });
2278
+ 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 });
2279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsLineChartComponent, decorators: [{
2280
+ type: Component,
2281
+ 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"] }]
2282
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i2.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
2283
+ type: Inject,
2284
+ args: [PLATFORM_ID]
2285
+ }] }, { type: undefined, decorators: [{
2286
+ type: Inject,
2287
+ args: [ESC_LOGS]
2288
+ }] }, { type: undefined, decorators: [{
2289
+ type: Inject,
2290
+ args: [ESC_ANIMATIONS]
2291
+ }] }, { type: undefined, decorators: [{
2292
+ type: Inject,
2293
+ args: [ESC_LOCALE]
2294
+ }] }, { type: undefined, decorators: [{
2295
+ type: Inject,
2296
+ args: [ESC_THEME]
2297
+ }] }]; }, propDecorators: { Data: [{
2298
+ type: Input
2299
+ }], DataArray: [{
2300
+ type: Input
2301
+ }], Step: [{
2302
+ type: Input
2303
+ }], DataGroupBucketSize: [{
2304
+ type: Input
2305
+ }], DataGroupingThreshold: [{
2306
+ type: Input
2307
+ }], StrokeSize: [{
2308
+ type: Input
2309
+ }], AllowGaps: [{
2310
+ type: Input
2311
+ }], MergeDatasets: [{
2312
+ type: Input
2313
+ }], FinalInstants: [{
2314
+ type: Input
2315
+ }], Min: [{
2316
+ type: Input
2317
+ }], Max: [{
2318
+ type: Input
2319
+ }], Fill: [{
2320
+ type: Input
2321
+ }] } });
2322
+
2323
+ /**
2324
+ * Componente specifico per la graficazione di un grafico a Torta
2325
+ */
2326
+ class EsPieChartComponent extends BaseChartComponent {
2327
+ /**
2328
+ * @ignore
2329
+ */
2330
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2331
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2332
+ this.adapter = adapter;
2333
+ }
2334
+ /**
2335
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2336
+ */
2337
+ getSpecificPropertiesToCheck() {
2338
+ return ["Data", "DataArray", "HideZeroes", "Mode3D", "LabelsWrap", "LabelsTruncate", "LabelsWidth", "LabelsVisible"];
2339
+ }
2340
+ /**
2341
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2342
+ *
2343
+ * @returns {PieChartSettings} Settings castati al tipo giusto
2344
+ */
2345
+ getCastedSettings() {
2346
+ return (this.Settings ?? new PieChartSettings());
2347
+ }
2348
+ /**
2349
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2350
+ *
2351
+ * @param {PieChartSettings} settingsCasted Settings castati al tipo giusto
2352
+ */
2353
+ fillSpecificSettings(settingsCasted) {
2354
+ settingsCasted.HideZeroes = settingsCasted.HideZeroes != null ? settingsCasted.HideZeroes : this.HideZeroes;
2355
+ settingsCasted.Mode3D = settingsCasted.Mode3D != null ? settingsCasted.Mode3D : this.Mode3D;
2356
+ settingsCasted.DonutRadiusPercentage = settingsCasted.DonutRadiusPercentage != null ? settingsCasted.DonutRadiusPercentage : this.DonutRadiusPercentage;
2357
+ settingsCasted.LabelsWrap = settingsCasted.LabelsWrap != null ? settingsCasted.LabelsWrap : this.LabelsWrap;
2358
+ settingsCasted.LabelsTruncate = settingsCasted.LabelsTruncate != null ? settingsCasted.LabelsTruncate : this.LabelsTruncate;
2359
+ settingsCasted.LabelsWidth = settingsCasted.LabelsWidth != null ? settingsCasted.LabelsWidth : this.LabelsWidth;
2360
+ settingsCasted.LabelsVisible = settingsCasted.LabelsVisible != null ? settingsCasted.LabelsVisible : this.LabelsVisible;
2361
+ }
2362
+ /**
2363
+ * Effettua il rendering di questo grafico in base ai Settings
2364
+ *
2365
+ * @param {PieChartSettings} settingsCasted Impostazioni di graficazione
2366
+ * @returns {PieChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2367
+ */
2368
+ graphicate(settingsCasted) {
2369
+ return new PieChartService(this.adapter).graphicate(this.Data, settingsCasted);
2370
+ }
2371
+ }
2372
+ 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 });
2373
+ 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 });
2374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsPieChartComponent, decorators: [{
2375
+ type: Component,
2376
+ 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"] }]
2377
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2378
+ type: Inject,
2379
+ args: [PLATFORM_ID]
2380
+ }] }, { type: undefined, decorators: [{
2381
+ type: Inject,
2382
+ args: [ESC_LOGS]
2383
+ }] }, { type: undefined, decorators: [{
2384
+ type: Inject,
2385
+ args: [ESC_ANIMATIONS]
2386
+ }] }, { type: undefined, decorators: [{
2387
+ type: Inject,
2388
+ args: [ESC_LOCALE]
2389
+ }] }, { type: undefined, decorators: [{
2390
+ type: Inject,
2391
+ args: [ESC_THEME]
2392
+ }] }]; }, propDecorators: { Data: [{
2393
+ type: Input
2394
+ }], DataArray: [{
2395
+ type: Input
2396
+ }], HideZeroes: [{
2397
+ type: Input
2398
+ }], Mode3D: [{
2399
+ type: Input
2400
+ }], DonutRadiusPercentage: [{
2401
+ type: Input
2402
+ }], LabelsWrap: [{
2403
+ type: Input
2404
+ }], LabelsTruncate: [{
2405
+ type: Input
2406
+ }], LabelsWidth: [{
2407
+ type: Input
2408
+ }], LabelsVisible: [{
2409
+ type: Input
2410
+ }] } });
2411
+
2412
+ /**
2413
+ * Componente specifico per la graficazione di un grafico a Barre con due dimensioni
2414
+ */
2415
+ class EsVertical2DChartComponent extends BaseChartComponent {
2416
+ /**
2417
+ * @ignore
2418
+ */
2419
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2420
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2421
+ this.adapter = adapter;
2422
+ }
2423
+ /**
2424
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2425
+ */
2426
+ getSpecificPropertiesToCheck() {
2427
+ return ["Data", "DataArray"];
2428
+ }
2429
+ /**
2430
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2431
+ *
2432
+ * @returns {Vertical2DChartSettings} Settings castati al tipo giusto
2433
+ */
2434
+ getCastedSettings() {
2435
+ return (this.Settings ?? new Vertical2DChartSettings());
2436
+ }
2437
+ /**
2438
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2439
+ *
2440
+ * @param {Vertical2DChartSettings} settingsCasted Settings castati al tipo giusto
2441
+ */
2442
+ fillSpecificSettings(settingsCasted) {
2443
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2444
+ settingsCasted.GroupPaddingPercentage = settingsCasted.GroupPaddingPercentage != null ? settingsCasted.GroupPaddingPercentage : this.GroupPaddingPercentage;
2445
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2446
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2447
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2448
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2449
+ }
2450
+ /**
2451
+ * Effettua il rendering di questo grafico in base ai Settings
2452
+ *
2453
+ * @param {Vertical2DChartSettings} settingsCasted Impostazioni di graficazione
2454
+ * @returns {Vertical2DChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2455
+ */
2456
+ graphicate(settingsCasted) {
2457
+ return new Vertical2DChartService(this.adapter).graphicate(this.Data, settingsCasted);
2458
+ }
2459
+ }
2460
+ 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 });
2461
+ 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 });
2462
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
2463
+ type: Component,
2464
+ 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"] }]
2465
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2466
+ type: Inject,
2467
+ args: [PLATFORM_ID]
2468
+ }] }, { type: undefined, decorators: [{
2469
+ type: Inject,
2470
+ args: [ESC_LOGS]
2471
+ }] }, { type: undefined, decorators: [{
2472
+ type: Inject,
2473
+ args: [ESC_ANIMATIONS]
2474
+ }] }, { type: undefined, decorators: [{
2475
+ type: Inject,
2476
+ args: [ESC_LOCALE]
2477
+ }] }, { type: undefined, decorators: [{
2478
+ type: Inject,
2479
+ args: [ESC_THEME]
2480
+ }] }]; }, propDecorators: { Data: [{
2481
+ type: Input
2482
+ }], DataArray: [{
2483
+ type: Input
2484
+ }], ColumnWidthPercentage: [{
2485
+ type: Input
2486
+ }], GroupPaddingPercentage: [{
2487
+ type: Input
2488
+ }], LabelWidth: [{
2489
+ type: Input
2490
+ }], LabelVerticalOrientationCutoffWidth: [{
2491
+ type: Input
2492
+ }], LabelRightWhenCompressed: [{
2493
+ type: Input
2494
+ }], LabelTopWhenCompressed: [{
2495
+ type: Input
2496
+ }] } });
2497
+
2498
+ /**
2499
+ * Componente specifico per la graficazione di un grafico a Barre
2500
+ */
2501
+ class EsVerticalChartComponent extends BaseChartComponent {
2502
+ /**
2503
+ * @ignore
2504
+ */
2505
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2506
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2507
+ this.adapter = adapter;
2508
+ }
2509
+ /**
2510
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2511
+ */
2512
+ getSpecificPropertiesToCheck() {
2513
+ return ["Data", "DataArray"];
2514
+ }
2515
+ /**
2516
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2517
+ *
2518
+ * @returns {VerticalChartSettings} Settings castati al tipo giusto
2519
+ */
2520
+ getCastedSettings() {
2521
+ return (this.Settings ?? new VerticalChartSettings());
2522
+ }
2523
+ /**
2524
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2525
+ *
2526
+ * @param {VerticalChartSettings} settingsCasted Settings castati al tipo giusto
2527
+ */
2528
+ fillSpecificSettings(settingsCasted) {
2529
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2530
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2531
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2532
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2533
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2534
+ }
2535
+ /**
2536
+ * Effettua il rendering di questo grafico in base ai Settings
2537
+ *
2538
+ * @param {VerticalChartSettings} settingsCasted Impostazioni di graficazione
2539
+ * @returns {VerticalChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2540
+ */
2541
+ graphicate(settingsCasted) {
2542
+ return new VerticalChartService(this.adapter).graphicate(this.Data, settingsCasted);
2543
+ }
2544
+ }
2545
+ 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 });
2546
+ 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 });
2547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
2548
+ type: Component,
2549
+ 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"] }]
2550
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2551
+ type: Inject,
2552
+ args: [PLATFORM_ID]
2553
+ }] }, { type: undefined, decorators: [{
2554
+ type: Inject,
2555
+ args: [ESC_LOGS]
2556
+ }] }, { type: undefined, decorators: [{
2557
+ type: Inject,
2558
+ args: [ESC_ANIMATIONS]
2559
+ }] }, { type: undefined, decorators: [{
2560
+ type: Inject,
2561
+ args: [ESC_LOCALE]
2562
+ }] }, { type: undefined, decorators: [{
2563
+ type: Inject,
2564
+ args: [ESC_THEME]
2565
+ }] }]; }, propDecorators: { Data: [{
2566
+ type: Input
2567
+ }], DataArray: [{
2568
+ type: Input
2569
+ }], ColumnWidthPercentage: [{
2570
+ type: Input
2571
+ }], LabelWidth: [{
2572
+ type: Input
2573
+ }], LabelVerticalOrientationCutoffWidth: [{
2574
+ type: Input
2575
+ }], LabelRightWhenCompressed: [{
2576
+ type: Input
2577
+ }], LabelTopWhenCompressed: [{
2578
+ type: Input
2579
+ }] } });
2580
+
2581
+ /**
2582
+ * Componente specifico per la graficazione di un grafico a Barre in modalità Stacked (una serie sopra l'altra)
2583
+ */
2584
+ class EsVerticalStackedChartComponent extends BaseChartComponent {
2585
+ /**
2586
+ * @ignore
2587
+ */
2588
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
2589
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME);
2590
+ this.adapter = adapter;
2591
+ }
2592
+ /**
2593
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2594
+ */
2595
+ getSpecificPropertiesToCheck() {
2596
+ return ["Data", "DataArray"];
2597
+ }
2598
+ /**
2599
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2600
+ *
2601
+ * @returns {VerticalStackedChartSettings} Settings castati al tipo giusto
2602
+ */
2603
+ getCastedSettings() {
2604
+ return (this.Settings ?? new VerticalStackedChartSettings());
2605
+ }
2606
+ /**
2607
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2608
+ *
2609
+ * @param {VerticalStackedChartSettings} settingsCasted Settings castati al tipo giusto
2610
+ */
2611
+ fillSpecificSettings(settingsCasted) {
2612
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2613
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2614
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2615
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2616
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2617
+ }
2618
+ /**
2619
+ * Effettua il rendering di questo grafico in base ai Settings
2620
+ *
2621
+ * @param {VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
2622
+ * @returns {VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2623
+ */
2624
+ graphicate(settingsCasted) {
2625
+ return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settingsCasted);
2626
+ }
2627
+ }
2628
+ 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 });
2629
+ 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 });
2630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsVerticalStackedChartComponent, decorators: [{
2631
+ type: Component,
2632
+ 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"] }]
2633
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2634
+ type: Inject,
2635
+ args: [PLATFORM_ID]
2636
+ }] }, { type: undefined, decorators: [{
2637
+ type: Inject,
2638
+ args: [ESC_LOGS]
2639
+ }] }, { type: undefined, decorators: [{
2640
+ type: Inject,
2641
+ args: [ESC_ANIMATIONS]
2642
+ }] }, { type: undefined, decorators: [{
2643
+ type: Inject,
2644
+ args: [ESC_LOCALE]
2645
+ }] }, { type: undefined, decorators: [{
2646
+ type: Inject,
2647
+ args: [ESC_THEME]
2648
+ }] }]; }, propDecorators: { Data: [{
2649
+ type: Input
2650
+ }], DataArray: [{
2651
+ type: Input
2652
+ }], ColumnWidthPercentage: [{
2653
+ type: Input
2654
+ }], LabelWidth: [{
2655
+ type: Input
2656
+ }], LabelVerticalOrientationCutoffWidth: [{
2657
+ type: Input
2658
+ }], LabelRightWhenCompressed: [{
2659
+ type: Input
2660
+ }], LabelTopWhenCompressed: [{
2661
+ type: Input
2662
+ }] } });
2663
+
2664
+ /**
2665
+ * Classe che identifica i dati per un grafico generico paginato
2666
+ */
2667
+ class PagedChartData {
2668
+ /**
2669
+ * Costruttore
2670
+ *
2671
+ * @param {T} data Dati del grafico
2672
+ * @param {string} title Titolo del grafico
2673
+ * @param {Object} dataRetrieveDto Dto utilizzato per recuperare i dati di questo grafico
2674
+ * @param {Function} dataRetrieveFunction Funzione utilizzata per ottenere i dati di questo grafico
2675
+ */
2676
+ constructor(data, title, dataRetrieveDto, dataRetrieveFunction) {
2677
+ this.data = data;
2678
+ this.title = title;
2679
+ this.dataRetrieveDto = dataRetrieveDto;
2680
+ this.dataRetrieveFunction = dataRetrieveFunction;
2681
+ }
2682
+ }
2683
+
2684
+ /** Componenti esportati dal modulo */
2685
+ const COMPONENTS = [
2686
+ EsChartComponent,
2687
+ EsLineChartComponent,
2688
+ EsPieChartComponent,
2689
+ EsVertical2DChartComponent,
2690
+ EsVerticalChartComponent,
2691
+ EsVerticalStackedChartComponent,
2692
+ PageChartSelector,
2693
+ EsAreaChartComponent
2694
+ ];
2695
+ class EsChartsModule {
2696
+ static forRoot(config) {
2697
+ return {
2698
+ ngModule: EsChartsModule,
2699
+ providers: [
2700
+ { provide: ESC_LOCALE, useValue: config?.locale || 'it-IT' },
2701
+ { provide: ESC_ANIMATIONS, useValue: config?.animations == null ? true : config?.animations },
2702
+ { provide: ESC_THEME, useValue: config?.theme || 'spiritedaway' },
2703
+ { provide: ESC_LOGS, useValue: config?.debugMode == null ? false : config?.debugMode },
2704
+ { provide: BaseAdapter, useClass: config?.adapter || BaseAdapter },
2705
+ // Singleton cattiva by Ema. Verificare strade migliori
2706
+ { provide: ChartLoader, useValue: new ChartLoader(config?.debugMode == null ? false : config?.debugMode) }
2707
+ ]
2708
+ };
2709
+ }
2710
+ }
2711
+ EsChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2712
+ EsChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
2713
+ EsLineChartComponent,
2714
+ EsPieChartComponent,
2715
+ EsVertical2DChartComponent,
2716
+ EsVerticalChartComponent,
2717
+ EsVerticalStackedChartComponent,
2718
+ PageChartSelector,
2719
+ EsAreaChartComponent], imports: [CommonModule], exports: [EsChartComponent,
2720
+ EsLineChartComponent,
2721
+ EsPieChartComponent,
2722
+ EsVertical2DChartComponent,
2723
+ EsVerticalChartComponent,
2724
+ EsVerticalStackedChartComponent,
2725
+ PageChartSelector,
2726
+ EsAreaChartComponent] });
2727
+ EsChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, providers: [ChartDispatcher], imports: [[CommonModule]] });
2728
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsChartsModule, decorators: [{
2729
+ type: NgModule,
2730
+ args: [{
2731
+ imports: [CommonModule],
2732
+ declarations: [...COMPONENTS],
2733
+ providers: [ChartDispatcher],
2734
+ exports: [...COMPONENTS]
2735
+ }]
2736
+ }] });
2737
+
2738
+ /*
2739
+ * Public API Surface of es-charts
2740
+ */
2741
+
2742
+ /**
2743
+ * Generated bundle index. Do not edit.
2744
+ */
2745
+
2746
+ export { AreaChartData, AreaChartSettings, BaseAdapter, BaseChartComponent, 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 };
2747
+ //# sourceMappingURL=esfaenza-es-charts.mjs.map