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