@esfaenza/es-charts 12.2.9 → 12.2.13
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 +72 -21
- package/bundles/esfaenza-es-charts.umd.js.map +1 -1
- package/esfaenza-es-charts.metadata.json +1 -1
- 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/public-api.js +2 -1
- package/fesm2015/esfaenza-es-charts.js +70 -21
- package/fesm2015/esfaenza-es-charts.js.map +1 -1
- 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
|
}());
|
|
@@ -1437,7 +1457,7 @@
|
|
|
1437
1457
|
*/
|
|
1438
1458
|
LineChartService.prototype.graphicate = function (data, settings) {
|
|
1439
1459
|
var _this = this;
|
|
1440
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
1460
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1441
1461
|
var dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
|
|
1442
1462
|
var threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
|
|
1443
1463
|
var singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
|
|
@@ -1448,7 +1468,6 @@
|
|
|
1448
1468
|
var interval = seriesWithInterval ? dataConverted.series.find(function (t) { return t.interval; }).interval : null;
|
|
1449
1469
|
var gapsAllowed = (settings === null || settings === void 0 ? void 0 : settings.AllowGaps) == null ? seriesWithInterval : settings === null || settings === void 0 ? void 0 : settings.AllowGaps;
|
|
1450
1470
|
var finalInstant = (_c = settings === null || settings === void 0 ? void 0 : settings.FinalInstants) !== null && _c !== void 0 ? _c : true;
|
|
1451
|
-
var fill = (_d = settings === null || settings === void 0 ? void 0 : settings.Fill) !== null && _d !== void 0 ? _d : false;
|
|
1452
1471
|
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
1453
1472
|
am4core__namespace.options.autoDispose = true;
|
|
1454
1473
|
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
@@ -1462,6 +1481,32 @@
|
|
|
1462
1481
|
yAxis.min = settings.Min;
|
|
1463
1482
|
if (settings.Max)
|
|
1464
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
|
+
}
|
|
1465
1510
|
var dateAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.DateAxis());
|
|
1466
1511
|
if (settings.XAxisTitle) {
|
|
1467
1512
|
dateAxis.title.text = settings.XAxisTitle;
|
|
@@ -1475,11 +1520,11 @@
|
|
|
1475
1520
|
dateAxis.renderer.ticks.template.length = 10;
|
|
1476
1521
|
dateAxis.renderer.ticks.template.location = 0;
|
|
1477
1522
|
}
|
|
1478
|
-
dateAxis.renderer.minGridDistance = (
|
|
1523
|
+
dateAxis.renderer.minGridDistance = (_d = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _d !== void 0 ? _d : 50;
|
|
1479
1524
|
dateAxis.renderer.grid.template.location = 0;
|
|
1480
1525
|
dateAxis.minZoomCount = 5;
|
|
1481
1526
|
dateAxis.groupData = dataShouldBeGrouped;
|
|
1482
|
-
dateAxis.groupCount = (
|
|
1527
|
+
dateAxis.groupCount = (_e = settings.DataGroupBucketSize) !== null && _e !== void 0 ? _e : this.DataGroupBucketSize;
|
|
1483
1528
|
//Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
|
|
1484
1529
|
if (gapsAllowed) {
|
|
1485
1530
|
if (!seriesWithInterval) {
|
|
@@ -1523,7 +1568,7 @@
|
|
|
1523
1568
|
}
|
|
1524
1569
|
//-- Fine generazione
|
|
1525
1570
|
dataConverted.series.forEach(function (s, index) {
|
|
1526
|
-
var _a, _b;
|
|
1571
|
+
var _a, _b, _c;
|
|
1527
1572
|
if (s.values[0] && !(s.values[0].d instanceof Date)) {
|
|
1528
1573
|
for (var v = 0; v < s.values.length; v++)
|
|
1529
1574
|
s.values[v].d = new Date(s.values[v].d);
|
|
@@ -1540,12 +1585,13 @@
|
|
|
1540
1585
|
}
|
|
1541
1586
|
if (!correctOrder)
|
|
1542
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);
|
|
1543
1589
|
var series = (settings === null || settings === void 0 ? void 0 : settings.Step) ? new am4charts__namespace.StepLineSeries() : new am4charts__namespace.LineSeries();
|
|
1544
1590
|
series.dataFields.valueY = "v" + (singleDataSet ? index : "");
|
|
1545
1591
|
series.dataFields.dateX = "d";
|
|
1546
1592
|
series.dataFields.measureUnit = s.uom;
|
|
1547
1593
|
series.name = s.name;
|
|
1548
|
-
series.strokeWidth = (
|
|
1594
|
+
series.strokeWidth = (_b = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _b !== void 0 ? _b : 1;
|
|
1549
1595
|
series.connect = !gapsAllowed;
|
|
1550
1596
|
series.minBulletDistance = 10;
|
|
1551
1597
|
series.tooltipText = singleDataSet ? "" : "{name}: [bold]{valueY}[/]";
|
|
@@ -1596,7 +1642,7 @@
|
|
|
1596
1642
|
series.data = s.values;
|
|
1597
1643
|
var segment = series.segments.template;
|
|
1598
1644
|
var hoverState = segment.states.create("hover");
|
|
1599
|
-
hoverState.properties.strokeWidth = ((
|
|
1645
|
+
hoverState.properties.strokeWidth = ((_c = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _c !== void 0 ? _c : 1) + 1;
|
|
1600
1646
|
var dimmed = segment.states.create("dimmed");
|
|
1601
1647
|
dimmed.properties.stroke = am4core__namespace.color("#dadada");
|
|
1602
1648
|
//Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
|
|
@@ -1617,17 +1663,17 @@
|
|
|
1617
1663
|
});
|
|
1618
1664
|
if (settings.Legend) {
|
|
1619
1665
|
this.ChartInstance.legend = new am4charts__namespace.Legend();
|
|
1620
|
-
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';
|
|
1621
1667
|
this.ChartInstance.legend.scrollable = true;
|
|
1622
1668
|
this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
|
|
1623
|
-
this.ChartInstance.legend.itemContainers.template.events.on("over", function (event) { _this.processOver(event.target.dataItem.dataContext
|
|
1624
|
-
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(); });
|
|
1625
1671
|
if (settings.LegendPadding) {
|
|
1626
1672
|
var template = this.ChartInstance.legend.itemContainers.template;
|
|
1627
|
-
template.paddingTop = (
|
|
1628
|
-
template.paddingBottom = (
|
|
1629
|
-
template.paddingLeft = (
|
|
1630
|
-
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;
|
|
1631
1677
|
}
|
|
1632
1678
|
}
|
|
1633
1679
|
this.ChartInstance.cursor = new am4charts__namespace.XYCursor();
|
|
@@ -1670,9 +1716,10 @@
|
|
|
1670
1716
|
}
|
|
1671
1717
|
};
|
|
1672
1718
|
/** @ignore */
|
|
1673
|
-
LineChartService.prototype.processOver = function (hoveredSeries
|
|
1719
|
+
LineChartService.prototype.processOver = function (hoveredSeries) {
|
|
1674
1720
|
var _this = this;
|
|
1675
1721
|
hoveredSeries.toFront();
|
|
1722
|
+
var fill = hoveredSeries.stacked;
|
|
1676
1723
|
hoveredSeries.segments.each(function (segment) {
|
|
1677
1724
|
segment.setState("hover");
|
|
1678
1725
|
if (!fill)
|
|
@@ -1681,17 +1728,20 @@
|
|
|
1681
1728
|
if (!fill)
|
|
1682
1729
|
hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
|
|
1683
1730
|
this.ChartInstance.series.each(function (series) {
|
|
1684
|
-
if (series != hoveredSeries)
|
|
1731
|
+
if (series != hoveredSeries) {
|
|
1732
|
+
var fill_1 = series.stacked;
|
|
1685
1733
|
series.segments.each(function (segment) {
|
|
1686
1734
|
segment.setState("dimmed");
|
|
1687
|
-
if (!
|
|
1735
|
+
if (!fill_1)
|
|
1688
1736
|
segment.fillSprite.fillOpacity = 0;
|
|
1689
1737
|
});
|
|
1738
|
+
}
|
|
1690
1739
|
});
|
|
1691
1740
|
};
|
|
1692
1741
|
/** @ignore */
|
|
1693
|
-
LineChartService.prototype.processOut = function (
|
|
1742
|
+
LineChartService.prototype.processOut = function () {
|
|
1694
1743
|
this.ChartInstance.series.each(function (series) {
|
|
1744
|
+
var fill = series.stacked;
|
|
1695
1745
|
series.segments.each(function (segment) {
|
|
1696
1746
|
segment.setState("default");
|
|
1697
1747
|
if (!fill)
|
|
@@ -3125,6 +3175,7 @@
|
|
|
3125
3175
|
exports.KeyValue = KeyValue;
|
|
3126
3176
|
exports.KeyValueColor = KeyValueColor;
|
|
3127
3177
|
exports.LegendPad = LegendPad;
|
|
3178
|
+
exports.Limit = Limit;
|
|
3128
3179
|
exports.LineChartData = LineChartData;
|
|
3129
3180
|
exports.LineChartSettings = LineChartSettings;
|
|
3130
3181
|
exports.LineSerie = LineSerie;
|