@esfaenza/es-charts 12.2.11 → 13.1.2

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