@esfaenza/es-charts 20.3.31 → 20.3.32
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.
|
@@ -1126,6 +1126,18 @@ function applyAnimatedTheme(root) {
|
|
|
1126
1126
|
root.setThemes([am5themes_Animated.new(root)]);
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
|
+
/**
|
|
1130
|
+
* Valore da passare ad amCharts: NaN (es. parseFloat di un valore assente) diventa null.
|
|
1131
|
+
*
|
|
1132
|
+
* amCharts5 salta solo null e undefined quando calcola minimo e massimo di una serie
|
|
1133
|
+
* (XYSeries, helper min/max con il confronto "left > right"): un NaN in mezzo ai dati rende NaN
|
|
1134
|
+
* il risultato, la serie viene esclusa dalla scala dell'asse e le colonne più alte escono tagliate.
|
|
1135
|
+
* Succede ad esempio con il misurato dei periodi futuri, che non ha valore.
|
|
1136
|
+
*/
|
|
1137
|
+
function chartValue(value) {
|
|
1138
|
+
return typeof value === "number" && isNaN(value) ? null : value;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1129
1141
|
/**
|
|
1130
1142
|
* Classe il cui unico scopo e gestire il setup e rendering di un LineChart
|
|
1131
1143
|
*/
|
|
@@ -1389,7 +1401,7 @@ class LineChartService {
|
|
|
1389
1401
|
var indexer = new Date(dataitem.d).valueOf();
|
|
1390
1402
|
if (!dto[indexer])
|
|
1391
1403
|
dto[indexer] = {};
|
|
1392
|
-
dto[indexer]['v' + index] = dataitem.v;
|
|
1404
|
+
dto[indexer]['v' + index] = chartValue(dataitem.v);
|
|
1393
1405
|
}
|
|
1394
1406
|
});
|
|
1395
1407
|
var dates = Object.keys(dto);
|
|
@@ -1488,7 +1500,7 @@ class LineChartService {
|
|
|
1488
1500
|
if (this.singleDataSet)
|
|
1489
1501
|
series.data.setAll(this.mergedData);
|
|
1490
1502
|
else
|
|
1491
|
-
series.data.setAll(source.values.map(item => ({ d: new Date(item.d).getTime(), v: item.v })));
|
|
1503
|
+
series.data.setAll(source.values.map(item => ({ d: new Date(item.d).getTime(), v: chartValue(item.v) })));
|
|
1492
1504
|
if (source.hidden)
|
|
1493
1505
|
series.hide(0);
|
|
1494
1506
|
return series;
|
|
@@ -1554,7 +1566,7 @@ class LineChartService {
|
|
|
1554
1566
|
if (this.singleDataSet)
|
|
1555
1567
|
scrollbarSeries.data.setAll(this.mergedData);
|
|
1556
1568
|
else
|
|
1557
|
-
scrollbarSeries.data.setAll(source.values.map(item => ({ d: new Date(item.d).getTime(), v: item.v })));
|
|
1569
|
+
scrollbarSeries.data.setAll(source.values.map(item => ({ d: new Date(item.d).getTime(), v: chartValue(item.v) })));
|
|
1558
1570
|
}
|
|
1559
1571
|
/** @ignore */
|
|
1560
1572
|
applyLocale(settings) {
|
|
@@ -2038,7 +2050,7 @@ class PieChartService {
|
|
|
2038
2050
|
}
|
|
2039
2051
|
// I dati vanno assegnati PRIMA di calcolare il totale e registrare gli handler: altrimenti i dataItems
|
|
2040
2052
|
// non esistono ancora e il totale verrebbe calcolato su una serie vuota (restando a 0)
|
|
2041
|
-
series.data.setAll(dataConverted.values);
|
|
2053
|
+
series.data.setAll(dataConverted.values.map(value => ({ ...value, v: chartValue(value.v) })));
|
|
2042
2054
|
// Configurazione "Mostra Totale"
|
|
2043
2055
|
if (settings.Total?.Show) {
|
|
2044
2056
|
// La label va agganciata al seriesContainer (la cui origine e il centro della torta) e centrata su
|
|
@@ -2065,11 +2077,11 @@ class PieChartService {
|
|
|
2065
2077
|
fs = 20;
|
|
2066
2078
|
else if (sumString.length == 7)
|
|
2067
2079
|
fs = 23;
|
|
2068
|
-
label.set("html", `<div style="text-align:center">
|
|
2069
|
-
<div style="font-size:${settings.Total?.TitleSize || 18}px">Totale:</div>
|
|
2070
|
-
<div style="font-weight:bold;font-size:${settings.Total?.NumberSize || fs}px">
|
|
2071
|
-
<span>${sumString}${settings.Total?.UnitOfMeasure ? " " + settings.Total.UnitOfMeasure : ""}</span>
|
|
2072
|
-
</div>
|
|
2080
|
+
label.set("html", `<div style="text-align:center">
|
|
2081
|
+
<div style="font-size:${settings.Total?.TitleSize || 18}px">Totale:</div>
|
|
2082
|
+
<div style="font-weight:bold;font-size:${settings.Total?.NumberSize || fs}px">
|
|
2083
|
+
<span>${sumString}${settings.Total?.UnitOfMeasure ? " " + settings.Total.UnitOfMeasure : ""}</span>
|
|
2084
|
+
</div>
|
|
2073
2085
|
</div>`);
|
|
2074
2086
|
};
|
|
2075
2087
|
updateTotal();
|
|
@@ -2154,6 +2166,7 @@ class VerticalChartService {
|
|
|
2154
2166
|
//#endregion
|
|
2155
2167
|
let chartData = dataConverted.values.map(value => ({
|
|
2156
2168
|
...value,
|
|
2169
|
+
v: chartValue(value.v),
|
|
2157
2170
|
c: typeof value.c == "string" ? am5.color(value.c) : value.c
|
|
2158
2171
|
}));
|
|
2159
2172
|
//#region Carico la Legenda
|
|
@@ -2520,7 +2533,7 @@ class Vertical2DChartService {
|
|
|
2520
2533
|
let obj = { key: item.name };
|
|
2521
2534
|
for (let p = 0; p < item.values.length; p++) {
|
|
2522
2535
|
let value = item.values[p];
|
|
2523
|
-
obj[value.k] = value.v;
|
|
2536
|
+
obj[value.k] = chartValue(value.v);
|
|
2524
2537
|
}
|
|
2525
2538
|
dataConverted.push(obj);
|
|
2526
2539
|
}
|
|
@@ -2753,7 +2766,7 @@ class VerticalStackedChartService {
|
|
|
2753
2766
|
let obj = { key: item.name };
|
|
2754
2767
|
for (let p = 0; p < item.values.length; p++) {
|
|
2755
2768
|
let value = item.values[p];
|
|
2756
|
-
obj[value.k] = value.v;
|
|
2769
|
+
obj[value.k] = chartValue(value.v);
|
|
2757
2770
|
}
|
|
2758
2771
|
dataConverted.push(obj);
|
|
2759
2772
|
}
|
|
@@ -2927,7 +2940,7 @@ class AreaChartService {
|
|
|
2927
2940
|
let dataItem = { date: new Date(group.name).getTime() };
|
|
2928
2941
|
for (let ii = 0; ii < group.values.length; ii++) {
|
|
2929
2942
|
let val = group.values[ii];
|
|
2930
|
-
dataItem[val.k] = val.v;
|
|
2943
|
+
dataItem[val.k] = chartValue(val.v);
|
|
2931
2944
|
if (!seriesToMakeCache[val.k]) {
|
|
2932
2945
|
seriesToMakeCache[val.k] = true;
|
|
2933
2946
|
seriesToMake.push(val.k);
|