@esfaenza/es-charts 12.2.8 → 12.2.12
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/bundles/esfaenza-es-charts.umd.js +79 -34
- package/bundles/esfaenza-es-charts.umd.js.map +1 -1
- package/esfaenza-es-charts.metadata.json +1 -1
- package/esm2015/lib/components/specializations/es-area-chart.component.js +2 -5
- package/esm2015/lib/es-charts.module.js +5 -3
- package/esm2015/lib/models/core/classes/ChartLoader.js +1 -9
- package/esm2015/lib/models/data/classes/LineChartData.js +4 -2
- package/esm2015/lib/models/data/classes/base/Limit.js +15 -0
- package/esm2015/lib/models/data/classes/base/LineSerie.js +5 -3
- package/esm2015/lib/models/data/index.js +2 -1
- package/esm2015/lib/services/classes/LineChartService.js +48 -18
- package/esm2015/lib/tokens.js +2 -2
- package/esm2015/public-api.js +2 -1
- package/fesm2015/esfaenza-es-charts.js +77 -34
- package/fesm2015/esfaenza-es-charts.js.map +1 -1
- package/lib/components/specializations/es-area-chart.component.d.ts +1 -3
- package/lib/models/data/classes/LineChartData.d.ts +4 -1
- package/lib/models/data/classes/base/Limit.d.ts +13 -0
- package/lib/models/data/classes/base/LineSerie.d.ts +4 -2
- package/lib/models/data/index.d.ts +1 -0
- package/package.json +6 -6
- package/public-api.d.ts +1 -0
|
@@ -82,10 +82,12 @@
|
|
|
82
82
|
* Costruttore
|
|
83
83
|
*
|
|
84
84
|
* @param {LineSerie[]} series Lista di serie da graficare
|
|
85
|
+
* @param {{upper: lower}}
|
|
85
86
|
*/
|
|
86
|
-
function LineChartData(series) {
|
|
87
|
+
function LineChartData(series, limit) {
|
|
87
88
|
if (series === void 0) { series = []; }
|
|
88
89
|
this.series = series;
|
|
90
|
+
this.limit = limit;
|
|
89
91
|
}
|
|
90
92
|
return LineChartData;
|
|
91
93
|
}());
|
|
@@ -591,6 +593,22 @@
|
|
|
591
593
|
return LegendPad;
|
|
592
594
|
}());
|
|
593
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
|
+
|
|
594
612
|
/**
|
|
595
613
|
* Modello che identifica la coppia Data-Valore
|
|
596
614
|
*/
|
|
@@ -638,15 +656,17 @@
|
|
|
638
656
|
* @param {string} name Nome della serie
|
|
639
657
|
* @param {DateValue[]} values Valori della serie
|
|
640
658
|
* @param {BaseInterval} interval Intervallo della serie. Viene utilizzato per gestire Gap e date in Istante Finale
|
|
641
|
-
* @param {string} color Colore della serie, verrà usato sia per la
|
|
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)
|
|
642
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
|
|
643
662
|
*/
|
|
644
|
-
function LineSerie(name, values, interval, color, uom) {
|
|
663
|
+
function LineSerie(name, values, interval, color, uom, fill) {
|
|
645
664
|
this.name = name;
|
|
646
665
|
this.values = values;
|
|
647
666
|
this.interval = interval;
|
|
648
667
|
this.color = color;
|
|
649
668
|
this.uom = uom;
|
|
669
|
+
this.fill = fill;
|
|
650
670
|
}
|
|
651
671
|
return LineSerie;
|
|
652
672
|
}());
|
|
@@ -666,7 +686,7 @@
|
|
|
666
686
|
/**
|
|
667
687
|
* Token che identifica l'utilizzo o meno del sistema di Log per l'intera libreria
|
|
668
688
|
*/
|
|
669
|
-
var ESC_LOGS = new core.InjectionToken('
|
|
689
|
+
var ESC_LOGS = new core.InjectionToken('ESC_LOGS');
|
|
670
690
|
|
|
671
691
|
/**
|
|
672
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
|
|
@@ -1095,13 +1115,7 @@
|
|
|
1095
1115
|
console.log("@esfaenza/es-charts: " + text);
|
|
1096
1116
|
};
|
|
1097
1117
|
return ChartLoader;
|
|
1098
|
-
}());
|
|
1099
|
-
ChartLoader.decorators = [
|
|
1100
|
-
{ type: core.Injectable }
|
|
1101
|
-
];
|
|
1102
|
-
ChartLoader.ctorParameters = function () { return [
|
|
1103
|
-
{ type: Boolean, decorators: [{ type: core.Inject, args: [ESC_LOGS,] }] }
|
|
1104
|
-
]; };
|
|
1118
|
+
}());
|
|
1105
1119
|
|
|
1106
1120
|
/**
|
|
1107
1121
|
* Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
|
|
@@ -1443,7 +1457,7 @@
|
|
|
1443
1457
|
*/
|
|
1444
1458
|
LineChartService.prototype.graphicate = function (data, settings) {
|
|
1445
1459
|
var _this = this;
|
|
1446
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
1460
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1447
1461
|
var dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
|
|
1448
1462
|
var threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
|
|
1449
1463
|
var singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
|
|
@@ -1454,7 +1468,6 @@
|
|
|
1454
1468
|
var interval = seriesWithInterval ? dataConverted.series.find(function (t) { return t.interval; }).interval : null;
|
|
1455
1469
|
var gapsAllowed = (settings === null || settings === void 0 ? void 0 : settings.AllowGaps) == null ? seriesWithInterval : settings === null || settings === void 0 ? void 0 : settings.AllowGaps;
|
|
1456
1470
|
var finalInstant = (_c = settings === null || settings === void 0 ? void 0 : settings.FinalInstants) !== null && _c !== void 0 ? _c : true;
|
|
1457
|
-
var fill = (_d = settings === null || settings === void 0 ? void 0 : settings.Fill) !== null && _d !== void 0 ? _d : false;
|
|
1458
1471
|
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
1459
1472
|
am4core__namespace.options.autoDispose = true;
|
|
1460
1473
|
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
@@ -1468,6 +1481,32 @@
|
|
|
1468
1481
|
yAxis.min = settings.Min;
|
|
1469
1482
|
if (settings.Max)
|
|
1470
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
|
+
}
|
|
1471
1510
|
var dateAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.DateAxis());
|
|
1472
1511
|
if (settings.XAxisTitle) {
|
|
1473
1512
|
dateAxis.title.text = settings.XAxisTitle;
|
|
@@ -1481,11 +1520,11 @@
|
|
|
1481
1520
|
dateAxis.renderer.ticks.template.length = 10;
|
|
1482
1521
|
dateAxis.renderer.ticks.template.location = 0;
|
|
1483
1522
|
}
|
|
1484
|
-
dateAxis.renderer.minGridDistance = (
|
|
1523
|
+
dateAxis.renderer.minGridDistance = (_d = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _d !== void 0 ? _d : 50;
|
|
1485
1524
|
dateAxis.renderer.grid.template.location = 0;
|
|
1486
1525
|
dateAxis.minZoomCount = 5;
|
|
1487
1526
|
dateAxis.groupData = dataShouldBeGrouped;
|
|
1488
|
-
dateAxis.groupCount = (
|
|
1527
|
+
dateAxis.groupCount = (_e = settings.DataGroupBucketSize) !== null && _e !== void 0 ? _e : this.DataGroupBucketSize;
|
|
1489
1528
|
//Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
|
|
1490
1529
|
if (gapsAllowed) {
|
|
1491
1530
|
if (!seriesWithInterval) {
|
|
@@ -1529,7 +1568,7 @@
|
|
|
1529
1568
|
}
|
|
1530
1569
|
//-- Fine generazione
|
|
1531
1570
|
dataConverted.series.forEach(function (s, index) {
|
|
1532
|
-
var _a, _b;
|
|
1571
|
+
var _a, _b, _c;
|
|
1533
1572
|
if (s.values[0] && !(s.values[0].d instanceof Date)) {
|
|
1534
1573
|
for (var v = 0; v < s.values.length; v++)
|
|
1535
1574
|
s.values[v].d = new Date(s.values[v].d);
|
|
@@ -1546,12 +1585,13 @@
|
|
|
1546
1585
|
}
|
|
1547
1586
|
if (!correctOrder)
|
|
1548
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);
|
|
1549
1589
|
var series = (settings === null || settings === void 0 ? void 0 : settings.Step) ? new am4charts__namespace.StepLineSeries() : new am4charts__namespace.LineSeries();
|
|
1550
1590
|
series.dataFields.valueY = "v" + (singleDataSet ? index : "");
|
|
1551
1591
|
series.dataFields.dateX = "d";
|
|
1552
1592
|
series.dataFields.measureUnit = s.uom;
|
|
1553
1593
|
series.name = s.name;
|
|
1554
|
-
series.strokeWidth = (
|
|
1594
|
+
series.strokeWidth = (_b = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _b !== void 0 ? _b : 1;
|
|
1555
1595
|
series.connect = !gapsAllowed;
|
|
1556
1596
|
series.minBulletDistance = 10;
|
|
1557
1597
|
series.tooltipText = singleDataSet ? "" : "{name}: [bold]{valueY}[/]";
|
|
@@ -1602,7 +1642,7 @@
|
|
|
1602
1642
|
series.data = s.values;
|
|
1603
1643
|
var segment = series.segments.template;
|
|
1604
1644
|
var hoverState = segment.states.create("hover");
|
|
1605
|
-
hoverState.properties.strokeWidth = ((
|
|
1645
|
+
hoverState.properties.strokeWidth = ((_c = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _c !== void 0 ? _c : 1) + 1;
|
|
1606
1646
|
var dimmed = segment.states.create("dimmed");
|
|
1607
1647
|
dimmed.properties.stroke = am4core__namespace.color("#dadada");
|
|
1608
1648
|
//Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
|
|
@@ -1623,17 +1663,17 @@
|
|
|
1623
1663
|
});
|
|
1624
1664
|
if (settings.Legend) {
|
|
1625
1665
|
this.ChartInstance.legend = new am4charts__namespace.Legend();
|
|
1626
|
-
this.ChartInstance.legend.position = (
|
|
1666
|
+
this.ChartInstance.legend.position = (_f = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _f !== void 0 ? _f : 'right';
|
|
1627
1667
|
this.ChartInstance.legend.scrollable = true;
|
|
1628
1668
|
this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
|
|
1629
|
-
this.ChartInstance.legend.itemContainers.template.events.on("over", function (event) { _this.processOver(event.target.dataItem.dataContext
|
|
1630
|
-
this.ChartInstance.legend.itemContainers.template.events.on("out", function (
|
|
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(); });
|
|
1631
1671
|
if (settings.LegendPadding) {
|
|
1632
1672
|
var template = this.ChartInstance.legend.itemContainers.template;
|
|
1633
|
-
template.paddingTop = (
|
|
1634
|
-
template.paddingBottom = (
|
|
1635
|
-
template.paddingLeft = (
|
|
1636
|
-
template.paddingRight = (
|
|
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;
|
|
1637
1677
|
}
|
|
1638
1678
|
}
|
|
1639
1679
|
this.ChartInstance.cursor = new am4charts__namespace.XYCursor();
|
|
@@ -1676,9 +1716,10 @@
|
|
|
1676
1716
|
}
|
|
1677
1717
|
};
|
|
1678
1718
|
/** @ignore */
|
|
1679
|
-
LineChartService.prototype.processOver = function (hoveredSeries
|
|
1719
|
+
LineChartService.prototype.processOver = function (hoveredSeries) {
|
|
1680
1720
|
var _this = this;
|
|
1681
1721
|
hoveredSeries.toFront();
|
|
1722
|
+
var fill = hoveredSeries.stacked;
|
|
1682
1723
|
hoveredSeries.segments.each(function (segment) {
|
|
1683
1724
|
segment.setState("hover");
|
|
1684
1725
|
if (!fill)
|
|
@@ -1687,17 +1728,20 @@
|
|
|
1687
1728
|
if (!fill)
|
|
1688
1729
|
hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
|
|
1689
1730
|
this.ChartInstance.series.each(function (series) {
|
|
1690
|
-
if (series != hoveredSeries)
|
|
1731
|
+
if (series != hoveredSeries) {
|
|
1732
|
+
var fill_1 = series.stacked;
|
|
1691
1733
|
series.segments.each(function (segment) {
|
|
1692
1734
|
segment.setState("dimmed");
|
|
1693
|
-
if (!
|
|
1735
|
+
if (!fill_1)
|
|
1694
1736
|
segment.fillSprite.fillOpacity = 0;
|
|
1695
1737
|
});
|
|
1738
|
+
}
|
|
1696
1739
|
});
|
|
1697
1740
|
};
|
|
1698
1741
|
/** @ignore */
|
|
1699
|
-
LineChartService.prototype.processOut = function (
|
|
1742
|
+
LineChartService.prototype.processOut = function () {
|
|
1700
1743
|
this.ChartInstance.series.each(function (series) {
|
|
1744
|
+
var fill = series.stacked;
|
|
1701
1745
|
series.segments.each(function (segment) {
|
|
1702
1746
|
segment.setState("default");
|
|
1703
1747
|
if (!fill)
|
|
@@ -2473,10 +2517,9 @@
|
|
|
2473
2517
|
/**
|
|
2474
2518
|
* @ignore
|
|
2475
2519
|
*/
|
|
2476
|
-
function EsAreaChartComponent(el, ChartLoader, ChartDispatcher, adapter,
|
|
2520
|
+
function EsAreaChartComponent(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) {
|
|
2477
2521
|
var _this = _super.call(this, el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, ESC_LOCALE, ESC_THEME) || this;
|
|
2478
2522
|
_this.adapter = adapter;
|
|
2479
|
-
_this.dateService = dateService;
|
|
2480
2523
|
return _this;
|
|
2481
2524
|
}
|
|
2482
2525
|
/**
|
|
@@ -2525,7 +2568,6 @@
|
|
|
2525
2568
|
{ type: ChartLoader },
|
|
2526
2569
|
{ type: ChartDispatcher },
|
|
2527
2570
|
{ type: BaseAdapter },
|
|
2528
|
-
{ type: extensions.DateService },
|
|
2529
2571
|
{ type: core.NgZone },
|
|
2530
2572
|
{ type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
|
|
2531
2573
|
{ type: Boolean, decorators: [{ type: core.Inject, args: [ESC_LOGS,] }] },
|
|
@@ -3090,7 +3132,9 @@
|
|
|
3090
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 },
|
|
3091
3133
|
{ provide: ESC_THEME, useValue: (config === null || config === void 0 ? void 0 : config.theme) || 'spiritedaway' },
|
|
3092
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 },
|
|
3093
|
-
{ provide: BaseAdapter, useClass: (config === null || config === void 0 ? void 0 : config.adapter) || BaseAdapter }
|
|
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) }
|
|
3094
3138
|
]
|
|
3095
3139
|
};
|
|
3096
3140
|
};
|
|
@@ -3100,7 +3144,7 @@
|
|
|
3100
3144
|
{ type: core.NgModule, args: [{
|
|
3101
3145
|
imports: [common.CommonModule],
|
|
3102
3146
|
declarations: __spreadArray([], __read(COMPONENTS)),
|
|
3103
|
-
providers: [
|
|
3147
|
+
providers: [ChartDispatcher],
|
|
3104
3148
|
exports: __spreadArray([], __read(COMPONENTS))
|
|
3105
3149
|
},] }
|
|
3106
3150
|
];
|
|
@@ -3131,6 +3175,7 @@
|
|
|
3131
3175
|
exports.KeyValue = KeyValue;
|
|
3132
3176
|
exports.KeyValueColor = KeyValueColor;
|
|
3133
3177
|
exports.LegendPad = LegendPad;
|
|
3178
|
+
exports.Limit = Limit;
|
|
3134
3179
|
exports.LineChartData = LineChartData;
|
|
3135
3180
|
exports.LineChartSettings = LineChartSettings;
|
|
3136
3181
|
exports.LineSerie = LineSerie;
|